17
17
#include < policy/fees.h>
18
18
#include < pow.h>
19
19
#include < rpc/blockchain.h>
20
+ #include < rpc/mining.h>
20
21
#include < rpc/server.h>
21
22
#include < rpc/util.h>
22
23
#include < script/descriptor.h>
@@ -206,7 +207,7 @@ static UniValue generatetodescriptor(const JSONRPCRequest& request)
206
207
{
207
208
{" num_blocks" , RPCArg::Type::NUM, RPCArg::Optional::NO, " How many blocks are generated immediately." },
208
209
{" descriptor" , RPCArg::Type::STR, RPCArg::Optional::NO, " The descriptor to send the newly generated bitcoin to." },
209
- {" maxtries" , RPCArg::Type::NUM, /* default */ " 1000000 " , " How many iterations to try." },
210
+ {" maxtries" , RPCArg::Type::NUM, /* default */ ToString (DEFAULT_MAX_TRIES) , " How many iterations to try." },
210
211
},
211
212
RPCResult{
212
213
RPCResult::Type::ARR, " " , " hashes of blocks generated" ,
@@ -220,7 +221,7 @@ static UniValue generatetodescriptor(const JSONRPCRequest& request)
220
221
.Check (request);
221
222
222
223
const int num_blocks{request.params [0 ].get_int ()};
223
- const int64_t max_tries{request.params [2 ].isNull () ? 1000000 : request.params [2 ].get_int ()};
224
+ const uint64_t max_tries{request.params [2 ].isNull () ? DEFAULT_MAX_TRIES : request.params [2 ].get_int ()};
224
225
225
226
CScript coinbase_script;
226
227
std::string error;
@@ -241,7 +242,7 @@ static UniValue generatetoaddress(const JSONRPCRequest& request)
241
242
{
242
243
{" nblocks" , RPCArg::Type::NUM, RPCArg::Optional::NO, " How many blocks are generated immediately." },
243
244
{" address" , RPCArg::Type::STR, RPCArg::Optional::NO, " The address to send the newly generated bitcoin to." },
244
- {" maxtries" , RPCArg::Type::NUM, /* default */ " 1000000 " , " How many iterations to try." },
245
+ {" maxtries" , RPCArg::Type::NUM, /* default */ ToString (DEFAULT_MAX_TRIES) , " How many iterations to try." },
245
246
},
246
247
RPCResult{
247
248
RPCResult::Type::ARR, " " , " hashes of blocks generated" ,
@@ -257,7 +258,7 @@ static UniValue generatetoaddress(const JSONRPCRequest& request)
257
258
}.Check (request);
258
259
259
260
int nGenerate = request.params [0 ].get_int ();
260
- uint64_t nMaxTries = 1000000 ;
261
+ uint64_t nMaxTries{DEFAULT_MAX_TRIES} ;
261
262
if (!request.params [2 ].isNull ()) {
262
263
nMaxTries = request.params [2 ].get_int ();
263
264
}
@@ -370,7 +371,7 @@ static UniValue generateblock(const JSONRPCRequest& request)
370
371
}
371
372
372
373
uint256 block_hash;
373
- uint64_t max_tries{1000000 };
374
+ uint64_t max_tries{DEFAULT_MAX_TRIES };
374
375
unsigned int extra_nonce{0 };
375
376
376
377
if (!GenerateBlock (EnsureChainman (request.context ), block, max_tries, extra_nonce, block_hash) || block_hash.IsNull ()) {
0 commit comments