Fix ending height bug and check that ending height is larger than starting height
This commit is contained in:
@@ -3716,11 +3716,15 @@ UniValue z_anonsetblockdelta(const UniValue& params, bool fHelp, const CPubKey&
|
||||
std::string strHeight2 = params[1].get_str();
|
||||
int nHeight2 = -1;
|
||||
try {
|
||||
nHeight = std::stoi(strHeight2);
|
||||
nHeight2 = std::stoi(strHeight2);
|
||||
} catch (const std::exception &e) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid ending block height parameter");
|
||||
}
|
||||
|
||||
if (nHeight2 <= nHeight) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Ending block height must be larger than starting height");
|
||||
}
|
||||
|
||||
if (nHeight2 < 0 || nHeight2 > chainActive.Height()) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Ending block height out of range");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user