Skip to content

Commit

Permalink
Move sleep-time from node argument to rpc argument (#1826)
Browse files Browse the repository at this point in the history
* Move sleep-time from node argument to rpc argument

* Fix logic for sleep_time parameters in votegovbatch
  • Loading branch information
DrPing authored Mar 17, 2023
1 parent b86cff2 commit 91f9058
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,6 @@ void SetupServerArgs()
gArgs.AddArg("-dftxworkers=<n>", strprintf("No. of parallel workers associated with the DfTx related work pool. Stock splits, parallel processing of the chain where appropriate, etc use this worker pool (default: %d)", DEFAULT_DFTX_WORKERS), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
gArgs.AddArg("-maxaddrratepersecond=<n>", strprintf("Sets MAX_ADDR_RATE_PER_SECOND limit for ADDR messages(default: %f)", MAX_ADDR_RATE_PER_SECOND), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
gArgs.AddArg("-maxaddrprocessingtokenbucket=<n>", strprintf("Sets MAX_ADDR_PROCESSING_TOKEN_BUCKET limit for ADDR messages(default: %d)", MAX_ADDR_PROCESSING_TOKEN_BUCKET), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
gArgs.AddArg("-sleep-time=<n>", "Sets sleeping time for voteGovBatch, by default the value is set to 500ms", ArgsManager::ALLOW_ANY, OptionsCategory::HIDDEN);

#if HAVE_DECL_DAEMON
gArgs.AddArg("-daemon", "Run in the background as a daemon and accept commands", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
Expand Down
8 changes: 5 additions & 3 deletions src/masternodes/rpc_proposals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,10 @@ UniValue votegovbatch(const JSONRPCRequest &request) {
{"proposalId", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "The proposal txid"},
{"masternodeId", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "The masternode ID, operator or owner address"},
{"decision", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "The vote decision (yes/no/neutral)"},
}},
},
}
},
{"sleepTime", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "Sets sleeping time for voteGovBatch, by default the value is set to 500ms"}

This comment has been minimized.

Copy link
@prasannavl

prasannavl Mar 19, 2023

Member

Please write help messages from a user point of view. This would not be helpful to a user on any level.

Better message: No. of milliseconds to wait between each vote. A small wait time is required for large number of nodes to prevent the votes from being too busy to broadcast TXs (default: 500)

},
RPCResult{"\"hash\" (string) The hex-encoded hash of broadcasted transaction\n"},
RPCExamples{HelpExampleCli("votegovbatch", "{{proposalId, masternodeId, yes}...}") +
HelpExampleRpc("votegovbatch", "{{proposalId, masternodeId, yes}...}")},
Expand All @@ -611,7 +613,7 @@ UniValue votegovbatch(const JSONRPCRequest &request) {
RPCTypeCheck(request.params, {UniValue::VARR}, false);

const auto &keys = request.params[0].get_array();
auto sleepTime = gArgs.GetBoolArg("-sleep-time", SLEEP_TIME_MILLIS);
auto sleepTime = (request.params.size() > 1 && request.params[1].isNull()) ? SLEEP_TIME_MILLIS : request.params[1].get_int();
auto neutralVotesAllowed = gArgs.GetBoolArg("-rpc-governance-accept-neutral", DEFAULT_RPC_GOV_NEUTRAL);

int targetHeight;
Expand Down

0 comments on commit 91f9058

Please sign in to comment.