fix: add missing client's argument parsing for RPC commands

This commit is contained in:
Konstantin Akimov 2024-07-12 03:20:15 +07:00
parent 37bd4009c1
commit d3e181f516
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524
3 changed files with 8 additions and 4 deletions

View File

@ -225,6 +225,10 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "getnodeaddresses", 0, "count"},
{ "addpeeraddress", 1, "port"},
{ "stop", 0, "wait" },
{ "verifychainlock", 2, "blockHeight" },
{ "verifyislock", 3, "maxHeight" },
{ "submitchainlock", 2, "blockHeight" },
{ "mnauth", 0, "nodeId" },
};
// clang-format on

View File

@ -617,7 +617,7 @@ static RPCHelpMan mnauth()
if (!Params().MineBlocksOnDemand())
throw std::runtime_error("mnauth for regression testing (-regtest mode) only");
int nodeId = ParseInt64V(request.params[0], "nodeId");
int64_t nodeId = request.params[0].get_int64();
uint256 proTxHash = ParseHashV(request.params[1], "proTxHash");
if (proTxHash.IsNull()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "proTxHash invalid");

View File

@ -974,7 +974,7 @@ static RPCHelpMan verifychainlock()
}
nBlockHeight = pIndex->nHeight;
} else {
nBlockHeight = ParseInt32V(request.params[2], "blockHeight");
nBlockHeight = request.params[2].get_int();
LOCK(cs_main);
if (nBlockHeight < 0) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range");
@ -1040,7 +1040,7 @@ static RPCHelpMan verifyislock()
int maxHeight{-1};
if (!request.params[3].isNull()) {
maxHeight = ParseInt32V(request.params[3], "maxHeight");
maxHeight = request.params[3].get_int();
}
int signHeight;
@ -1094,7 +1094,7 @@ static RPCHelpMan submitchainlock()
{
const uint256 nBlockHash(ParseHashV(request.params[0], "blockHash"));
const int nBlockHeight = ParseInt32V(request.params[2], "blockHeight");
const int nBlockHeight = request.params[2].get_int();
if (nBlockHeight <= 0) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "invalid block height");
}