|
17 | 17 | #include <node/transaction.h> |
18 | 18 | #include <policy/feerate.h> |
19 | 19 | #include <policy/fees.h> |
20 | | -#include <rpc/mining.h> |
21 | 20 | #include <rpc/rawtransaction.h> |
22 | 21 | #include <rpc/server.h> |
23 | 22 | #include <rpc/util.h> |
@@ -3533,63 +3532,6 @@ UniValue signrawtransactionwithwallet(const JSONRPCRequest& request) |
3533 | 3532 | return SignTransaction(pwallet->chain(), mtx, request.params[1], pwallet, false, request.params[2]); |
3534 | 3533 | } |
3535 | 3534 |
|
3536 | | -#if ENABLE_MINER |
3537 | | -UniValue generate(const JSONRPCRequest& request) |
3538 | | -{ |
3539 | | - std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); |
3540 | | - CWallet* const pwallet = wallet.get(); |
3541 | | - |
3542 | | - |
3543 | | - if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { |
3544 | | - return NullUniValue; |
3545 | | - } |
3546 | | - |
3547 | | - if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { |
3548 | | - throw std::runtime_error( |
3549 | | - RPCHelpMan{"generate", |
3550 | | - "\nMine up to nblocks blocks immediately (before the RPC call returns) to an address in the wallet.\n", |
3551 | | - { |
3552 | | - {"nblocks", RPCArg::Type::NUM, RPCArg::Optional::NO, "How many blocks are generated immediately."}, |
3553 | | - {"maxtries", RPCArg::Type::NUM, /* default */ "1000000", "How many iterations to try."}, |
3554 | | - }, |
3555 | | - RPCResult{ |
3556 | | - "[ blockhashes ] (array) hashes of blocks generated\n" |
3557 | | - }, |
3558 | | - RPCExamples{ |
3559 | | - "\nGenerate 11 blocks\n" |
3560 | | - + HelpExampleCli("generate", "11") |
3561 | | - }, |
3562 | | - }.ToString()); |
3563 | | - } |
3564 | | - |
3565 | | - int num_generate = request.params[0].get_int(); |
3566 | | - uint64_t max_tries = 1000000; |
3567 | | - if (!request.params[1].isNull()) { |
3568 | | - max_tries = request.params[1].get_int(); |
3569 | | - } |
3570 | | - |
3571 | | - std::shared_ptr<CReserveScript> coinbase_script; |
3572 | | - pwallet->GetScriptForMining(coinbase_script); |
3573 | | - |
3574 | | - // If the keypool is exhausted, no script is returned at all. Catch this. |
3575 | | - if (!coinbase_script) { |
3576 | | - throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, "Error: Keypool ran out, please call keypoolrefill first"); |
3577 | | - } |
3578 | | - |
3579 | | - //throw an error if no script was provided |
3580 | | - if (coinbase_script->reserveScript.empty()) { |
3581 | | - throw JSONRPCError(RPC_INTERNAL_ERROR, "No coinbase script available"); |
3582 | | - } |
3583 | | - |
3584 | | - return generateBlocks(coinbase_script, num_generate, max_tries, true); |
3585 | | -} |
3586 | | -#else |
3587 | | -UniValue generate(const JSONRPCRequest& request) |
3588 | | -{ |
3589 | | - throw JSONRPCError(RPC_METHOD_NOT_FOUND, "This call is not available because RPC miner isn't compiled"); |
3590 | | -} |
3591 | | -#endif //ENABLE_MINING |
3592 | | - |
3593 | 3535 | static UniValue rescanblockchain(const JSONRPCRequest& request) |
3594 | 3536 | { |
3595 | 3537 | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); |
@@ -4205,11 +4147,6 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request) |
4205 | 4147 | static const CRPCCommand commands[] = |
4206 | 4148 | { // category name actor (function) argNames |
4207 | 4149 | // --------------------- ------------------------ ----------------------- ---------- |
4208 | | -#if ENABLE_MINER |
4209 | | - { "generating", "generate", &generate, {"nblocks","maxtries"} }, |
4210 | | -#else |
4211 | | - { "hidden", "generate", &generate, {"nblocks","maxtries"} }, // Hidden as it isn't functional, just an error to let people know if miner isn't compiled |
4212 | | -#endif //ENABLE_MINER |
4213 | 4150 | { "hidden", "instantsendtoaddress", &instantsendtoaddress, {} }, |
4214 | 4151 | { "hidden", "resendwallettransactions", &resendwallettransactions, {} }, |
4215 | 4152 | { "rawtransactions", "fundrawtransaction", &fundrawtransaction, {"hexstring","options"} }, |
|
0 commit comments