|
13 | 13 | #include <policy/feerate.h> |
14 | 14 | #include <policy/fees.h> |
15 | 15 | #include <rpc/blockchain.h> |
16 | | -#include <rpc/mining.h> |
17 | 16 | #include <rpc/rawtransaction_util.h> |
18 | 17 | #include <rpc/server.h> |
19 | 18 | #include <rpc/util.h> |
@@ -3326,61 +3325,6 @@ UniValue signrawtransactionwithwallet(const JSONRPCRequest& request) |
3326 | 3325 | return SignTransaction(mtx, request.params[1], pwallet, coins, false, request.params[2]); |
3327 | 3326 | } |
3328 | 3327 |
|
3329 | | -#if ENABLE_MINER |
3330 | | -UniValue generate(const JSONRPCRequest& request) |
3331 | | -{ |
3332 | | - if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { |
3333 | | - throw std::runtime_error( |
3334 | | - RPCHelpMan{"generate", |
3335 | | - "\nMine up to nblocks blocks immediately (before the RPC call returns) to an address in the wallet.\n", |
3336 | | - { |
3337 | | - {"nblocks", RPCArg::Type::NUM, RPCArg::Optional::NO, "How many blocks are generated immediately."}, |
3338 | | - {"maxtries", RPCArg::Type::NUM, /* default */ "1000000", "How many iterations to try."}, |
3339 | | - }, |
3340 | | - RPCResult{ |
3341 | | - "[ blockhashes ] (json array) hashes of blocks generated\n" |
3342 | | - }, |
3343 | | - RPCExamples{ |
3344 | | - "\nGenerate 11 blocks\n" |
3345 | | - + HelpExampleCli("generate", "11") |
3346 | | - }, |
3347 | | - }.ToString()); |
3348 | | - } |
3349 | | - |
3350 | | - std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); |
3351 | | - if (!wallet) return NullUniValue; |
3352 | | - CWallet* const pwallet = wallet.get(); |
3353 | | - |
3354 | | - int num_generate = request.params[0].get_int(); |
3355 | | - uint64_t max_tries = 1000000; |
3356 | | - if (!request.params[1].isNull()) { |
3357 | | - max_tries = request.params[1].get_int(); |
3358 | | - } |
3359 | | - |
3360 | | - std::shared_ptr<CReserveScript> coinbase_script; |
3361 | | - pwallet->GetScriptForMining(coinbase_script); |
3362 | | - |
3363 | | - // If the keypool is exhausted, no script is returned at all. Catch this. |
3364 | | - if (!coinbase_script) { |
3365 | | - throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, "Error: Keypool ran out, please call keypoolrefill first"); |
3366 | | - } |
3367 | | - |
3368 | | - //throw an error if no script was provided |
3369 | | - if (coinbase_script->reserveScript.empty()) { |
3370 | | - throw JSONRPCError(RPC_INTERNAL_ERROR, "No coinbase script available"); |
3371 | | - } |
3372 | | - |
3373 | | - const CTxMemPool& mempool = EnsureMemPool(); |
3374 | | - |
3375 | | - return generateBlocks(mempool, coinbase_script, num_generate, max_tries, true); |
3376 | | -} |
3377 | | -#else |
3378 | | -UniValue generate(const JSONRPCRequest& request) |
3379 | | -{ |
3380 | | - throw JSONRPCError(RPC_METHOD_NOT_FOUND, "This call is not available because RPC miner isn't compiled"); |
3381 | | -} |
3382 | | -#endif //ENABLE_MINING |
3383 | | - |
3384 | 3328 | static UniValue rescanblockchain(const JSONRPCRequest& request) |
3385 | 3329 | { |
3386 | 3330 | if (request.fHelp || request.params.size() > 2) { |
@@ -3984,11 +3928,6 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request) |
3984 | 3928 | static const CRPCCommand commands[] = |
3985 | 3929 | { // category name actor (function) argNames |
3986 | 3930 | // --------------------- ------------------------ ----------------------- ---------- |
3987 | | -#if ENABLE_MINER |
3988 | | - { "generating", "generate", &generate, {"nblocks","maxtries"} }, |
3989 | | -#else |
3990 | | - { "hidden", "generate", &generate, {"nblocks","maxtries"} }, // Hidden as it isn't functional, just an error to let people know if miner isn't compiled |
3991 | | -#endif //ENABLE_MINER |
3992 | 3931 | { "hidden", "instantsendtoaddress", &instantsendtoaddress, {} }, |
3993 | 3932 | { "rawtransactions", "fundrawtransaction", &fundrawtransaction, {"hexstring","options"} }, |
3994 | 3933 | { "wallet", "abandontransaction", &abandontransaction, {"txid"} }, |
|
0 commit comments