From 7d27682c95b065d4ffa31856a5a474d4ff9daa41 Mon Sep 17 00:00:00 2001 From: cedric ogire Date: Fri, 17 Mar 2023 17:26:09 +0800 Subject: [PATCH] Fix logic for sleep_time parameters in votegovbatch --- src/masternodes/rpc_proposals.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/masternodes/rpc_proposals.cpp b/src/masternodes/rpc_proposals.cpp index ecf974963f7..cf0c4ecce11 100644 --- a/src/masternodes/rpc_proposals.cpp +++ b/src/masternodes/rpc_proposals.cpp @@ -595,7 +595,8 @@ 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"} }, RPCResult{"\"hash\" (string) The hex-encoded hash of broadcasted transaction\n"}, @@ -612,7 +613,7 @@ UniValue votegovbatch(const JSONRPCRequest &request) { RPCTypeCheck(request.params, {UniValue::VARR}, false); const auto &keys = request.params[0].get_array(); - auto sleepTime = request.params[1].isNull() ? SLEEP_TIME_MILLIS : request.params[1].get_int(); + 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;