mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
check for null values in rpc args and handle appropriately
This commit is contained in:
@@ -101,7 +101,7 @@ UniValue getnetworkhashps(const JSONRPCRequest& request)
|
||||
);
|
||||
|
||||
LOCK(cs_main);
|
||||
return GetNetworkHashPS(request.params.size() > 0 ? request.params[0].get_int() : 120, request.params.size() > 1 ? request.params[1].get_int() : -1);
|
||||
return GetNetworkHashPS(!request.params[0].isNull() ? request.params[0].get_int() : 120, !request.params[1].isNull() ? request.params[1].get_int() : -1);
|
||||
}
|
||||
|
||||
UniValue generateBlocks(std::shared_ptr<CReserveScript> coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript)
|
||||
@@ -171,7 +171,7 @@ UniValue generatetoaddress(const JSONRPCRequest& request)
|
||||
|
||||
int nGenerate = request.params[0].get_int();
|
||||
uint64_t nMaxTries = 1000000;
|
||||
if (request.params.size() > 2) {
|
||||
if (!request.params[2].isNull()) {
|
||||
nMaxTries = request.params[2].get_int();
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
|
||||
UniValue lpval = NullUniValue;
|
||||
std::set<std::string> setClientRules;
|
||||
int64_t nMaxVersionPreVB = -1;
|
||||
if (request.params.size() > 0)
|
||||
if (!request.params[0].isNull())
|
||||
{
|
||||
const UniValue& oparam = request.params[0].get_obj();
|
||||
const UniValue& modeval = find_value(oparam, "mode");
|
||||
|
||||
Reference in New Issue
Block a user