Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ Commands:
-togglemainaux <MODE_0> <Mode_1>
Remotely toggle Main/Aux mode on node, valid seed and node ip/port are required.
<MODE_0> and <MODE_1> value are: MAIN or AUX
-setsolutionthreshold <EPOCH> <SOLUTION_THRESHOLD>
Remotely set solution threshold for future epoch, valid seed and node ip/port are required.
-setsolutionthreshold <EPOCH> <SOLUTION_THRESHOLD> <ALGO_TYPE_INDEX>
Remotely set solution threshold for future epoch, valid seed and node ip/port are required. <ALGO_TYPE_INDEX>: 0 - HYPERIDENTITY, 1 - ADDITION
-refreshpeerlist
(equivalent to F4) Remotely refresh the peer list of node, all current connections will be closed after this command is sent, valid seed and node ip/port are required.
-forcenexttick
Expand Down
3 changes: 2 additions & 1 deletion argparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,8 @@ void parseArgument(int argc, char** argv)
g_cmd = SET_SOLUTION_THRESHOLD;
g_setSolutionThresholdEpoch = int(charToNumber(argv[i+1]));
g_setSolutionThresholdValue = int(charToNumber(argv[i+2]));
i+=3;
g_setSolutionThresholdAlgo = int(charToNumber(argv[i+3]));
i+=4;
CHECK_OVER_PARAMETERS
break;
}
Expand Down
1 change: 1 addition & 0 deletions global.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ char* g_toggleMainAux0 = nullptr;
char* g_toggleMainAux1 = nullptr;
int g_setSolutionThresholdEpoch = -1;
int g_setSolutionThresholdValue = -1;
int g_setSolutionThresholdAlgo = -1;
char* g_filePath = nullptr;
char* g_compressTool = nullptr;
uint32_t g_contractIndex = 0;
Expand Down
3 changes: 2 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ int run(int argc, char* argv[])
sanityCheckSeed(g_seed);
checkValidEpoch(g_setSolutionThresholdEpoch);
checkValidSolutionThreshold(g_setSolutionThresholdValue);
setSolutionThreshold(g_nodeIp, g_nodePort, g_seed, g_setSolutionThresholdEpoch, g_setSolutionThresholdValue);
checkValidSolutionThresholdAlgo(g_setSolutionThresholdAlgo);
setSolutionThreshold(g_nodeIp, g_nodePort, g_seed, g_setSolutionThresholdEpoch, g_setSolutionThresholdValue, g_setSolutionThresholdAlgo);
break;
case SEND_SPECIAL_COMMAND:
case REFRESH_PEER_LIST:
Expand Down
6 changes: 4 additions & 2 deletions node_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ void printSystemInfoFromNode(const char* nodeIp, int nodePort)
byteToHex(curSystemInfo.randomMiningSeed, hex, 32);
LOG("RandomMiningSeed: %s\n", hex);
LOG("SolutionThreshold: %u\n", curSystemInfo.solutionThreshold);
LOG("AdditionSolutionThreshold: %llu\n", curSystemInfo.solutionAdditionalThreshold);

// todo: add initial time

Expand Down Expand Up @@ -1296,7 +1297,7 @@ void toggleMainAux(const char* nodeIp, const int nodePort, const char* seed, std
}
}

void setSolutionThreshold(const char* nodeIp, const int nodePort, const char* seed, int epoch, int threshold)
void setSolutionThreshold(const char* nodeIp, const int nodePort, const char* seed, int epoch, int threshold, int algo)
{
uint8_t privateKey[32] = {0};
uint8_t sourcePublicKey[32] = {0};
Expand All @@ -1317,6 +1318,7 @@ void setSolutionThreshold(const char* nodeIp, const int nodePort, const char* se
packet.cmd.everIncreasingNonceAndCommandType = commandByte | curTime;
packet.cmd.epoch = epoch;
packet.cmd.threshold = threshold;
packet.cmd.algoType = algo;

getSubseedFromSeed((uint8_t*)seed, subseed);
getPrivateKeyFromSubSeed(subseed, privateKey);
Expand All @@ -1342,7 +1344,7 @@ void setSolutionThreshold(const char* nodeIp, const int nodePort, const char* se

if (response.everIncreasingNonceAndCommandType == packet.cmd.everIncreasingNonceAndCommandType)
{
if (response.epoch == packet.cmd.epoch && response.threshold == packet.cmd.threshold)
if (response.epoch == packet.cmd.epoch && response.threshold == packet.cmd.threshold && response.algoType == packet.cmd.algoType)
{
LOG("Successfully set solution threshold\n");
}
Expand Down
2 changes: 1 addition & 1 deletion node_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void getVoteCounterTransaction(const char* nodeIp, const int nodePort, unsigned
void uploadFile(const char* nodeIp, const int nodePort, const char* filePath, const char* seed, unsigned int tickOffset, const char* compressTool = nullptr);
// remote tools:
void toggleMainAux(const char* nodeIp, const int nodePort, const char* seed, std::string mode0, std::string mode1);
void setSolutionThreshold(const char* nodeIp, const int nodePort, const char* seed, int epoch, int threshold);
void setSolutionThreshold(const char* nodeIp, const int nodePort, const char* seed, int epoch, int threshold, int algoType);
void syncTime(const char* nodeIp, const int nodePort, const char* seed);
void setLoggingMode(const char* nodeIp, const int nodePort, const char* seed, char mode);
void broadcastCompChat(const char* nodeIp, const int nodePort, const char* seed, char* compChatMsg);
Expand Down
10 changes: 10 additions & 0 deletions sanity_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,16 @@ static void checkValidSolutionThreshold(int thres)
exit(1);
}

static void checkValidSolutionThresholdAlgo(int algo)
{
if (algo >= 0 && algo < 2)
{
return;
}
LOG("As of now, the only supported values are 0:hyperidentity, 1:addition\n");
exit(1);
}

static void sanityCheckValidAssetName(const char * name)
{
bool okay = false;
Expand Down
6 changes: 4 additions & 2 deletions structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ struct CurrentSystemInfo
unsigned long long currentEntityBalanceDustThreshold;

unsigned int targetTickVoteSignature;
unsigned long long _reserve0;
unsigned long long _reserve1;
unsigned long long computorPacketSignature;
unsigned long long solutionAdditionalThreshold;
unsigned long long _reserve2;
unsigned long long _reserve3;
unsigned long long _reserve4;
Expand Down Expand Up @@ -793,6 +793,8 @@ struct SpecialCommandSetSolutionThresholdResquestAndResponse
unsigned long long everIncreasingNonceAndCommandType;
unsigned int epoch;
int threshold;
int algoType;
int padding;
static constexpr unsigned char type()
{
return 255;
Expand Down