mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
merge bitcoin#19250: Make RPC help compile-time static
This commit is contained in:
parent
121553596a
commit
7573b1286c
@ -18,10 +18,6 @@
|
||||
#ifdef ENABLE_WALLET
|
||||
static UniValue coinjoin(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"coinjoin",
|
||||
@ -36,6 +32,10 @@ static UniValue coinjoin(const JSONRPCRequest& request)
|
||||
RPCExamples{""},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (fMasternodeMode)
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Client-side mixing is not supported on masternodes");
|
||||
|
||||
|
@ -270,14 +270,14 @@ static void gobject_list_prepared_help(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue gobject_list_prepared(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || (request.params.size() > 2)) {
|
||||
gobject_list_prepared_help(request);
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
EnsureWalletIsUnlocked(pwallet);
|
||||
|
||||
int64_t nCount = request.params.size() > 1 ? ParseInt64V(request.params[1], "count") : 10;
|
||||
@ -612,13 +612,13 @@ static void gobject_vote_many_help(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue gobject_vote_many(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 4)
|
||||
gobject_vote_many_help(request);
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 4)
|
||||
gobject_vote_many_help(request);
|
||||
|
||||
uint256 hash = ParseHashV(request.params[1], "Object hash");
|
||||
std::string strVoteSignal = request.params[2].get_str();
|
||||
std::string strVoteOutcome = request.params[3].get_str();
|
||||
@ -668,13 +668,13 @@ static void gobject_vote_alias_help(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue gobject_vote_alias(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 5)
|
||||
gobject_vote_alias_help(request);
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 5)
|
||||
gobject_vote_alias_help(request);
|
||||
|
||||
uint256 hash = ParseHashV(request.params[1], "Object hash");
|
||||
std::string strVoteSignal = request.params[2].get_str();
|
||||
std::string strVoteOutcome = request.params[3].get_str();
|
||||
|
@ -202,13 +202,12 @@ static void masternode_outputs_help(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue masternode_outputs(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp)
|
||||
masternode_outputs_help(request);
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Find possible candidates
|
||||
std::vector<COutput> vPossibleCoins;
|
||||
|
@ -432,10 +432,6 @@ static void protx_register_submit_help(const JSONRPCRequest& request)
|
||||
// handles register, register_prepare and register_fund in one method
|
||||
static UniValue protx_register(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
bool isExternalRegister = request.params[0].get_str() == "register";
|
||||
bool isFundRegister = request.params[0].get_str() == "register_fund";
|
||||
bool isPrepareRegister = request.params[0].get_str() == "register_prepare";
|
||||
@ -448,6 +444,10 @@ static UniValue protx_register(const JSONRPCRequest& request)
|
||||
protx_register_prepare_help(request);
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (isExternalRegister || isFundRegister) {
|
||||
EnsureWalletIsUnlocked(pwallet);
|
||||
}
|
||||
@ -593,14 +593,14 @@ static UniValue protx_register(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue protx_register_submit(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 3) {
|
||||
protx_register_submit_help(request);
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
EnsureWalletIsUnlocked(pwallet);
|
||||
|
||||
CMutableTransaction tx;
|
||||
@ -649,13 +649,13 @@ static void protx_update_service_help(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue protx_update_service(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || (request.params.size() < 4 || request.params.size() > 6))
|
||||
protx_update_service_help(request);
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || (request.params.size() < 4 || request.params.size() > 6))
|
||||
protx_update_service_help(request);
|
||||
|
||||
EnsureWalletIsUnlocked(pwallet);
|
||||
|
||||
CProUpServTx ptx;
|
||||
@ -746,14 +746,14 @@ static void protx_update_registrar_help(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue protx_update_registrar(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || (request.params.size() != 5 && request.params.size() != 6)) {
|
||||
protx_update_registrar_help(request);
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
EnsureWalletIsUnlocked(pwallet);
|
||||
|
||||
CProUpRegTx ptx;
|
||||
@ -836,14 +836,14 @@ static void protx_revoke_help(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue protx_revoke(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || (request.params.size() < 3 || request.params.size() > 5)) {
|
||||
protx_revoke_help(request);
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
EnsureWalletIsUnlocked(pwallet);
|
||||
|
||||
CProUpRevTx ptx;
|
||||
@ -993,11 +993,16 @@ static UniValue protx_list(const JSONRPCRequest& request)
|
||||
protx_list_help(request);
|
||||
}
|
||||
|
||||
CWallet* pwallet;
|
||||
#ifdef ENABLE_WALLET
|
||||
try {
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
CWallet* const pwallet = wallet.get();
|
||||
pwallet = wallet.get();
|
||||
} catch (...) {
|
||||
pwallet = nullptr;
|
||||
}
|
||||
#else
|
||||
CWallet* const pwallet = nullptr;
|
||||
pwallet = nullptr;
|
||||
#endif
|
||||
|
||||
std::string type = "registered";
|
||||
@ -1096,11 +1101,16 @@ static UniValue protx_info(const JSONRPCRequest& request)
|
||||
protx_info_help(request);
|
||||
}
|
||||
|
||||
CWallet* pwallet;
|
||||
#ifdef ENABLE_WALLET
|
||||
try {
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
CWallet* const pwallet = wallet.get();
|
||||
pwallet = wallet.get();
|
||||
} catch (...) {
|
||||
pwallet = nullptr;
|
||||
}
|
||||
#else
|
||||
CWallet* const pwallet = nullptr;
|
||||
pwallet = nullptr;
|
||||
#endif
|
||||
|
||||
if (g_txindex) {
|
||||
|
@ -83,10 +83,6 @@ static void RescanWallet(CWallet& wallet, const WalletRescanReserver& reserver,
|
||||
|
||||
UniValue importprivkey(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"importprivkey",
|
||||
@ -114,6 +110,10 @@ UniValue importprivkey(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (pwallet->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS)) {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Cannot import private keys to a wallet with private keys disabled");
|
||||
}
|
||||
@ -182,10 +182,6 @@ UniValue importprivkey(const JSONRPCRequest& request)
|
||||
|
||||
UniValue abortrescan(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() > 0)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"abortrescan",
|
||||
@ -202,6 +198,10 @@ UniValue abortrescan(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (!pwallet->IsScanning() || pwallet->IsAbortingRescan()) return false;
|
||||
pwallet->AbortRescan();
|
||||
return true;
|
||||
@ -247,10 +247,6 @@ static void ImportAddress(CWallet * const pwallet, const CTxDestination& dest, c
|
||||
|
||||
UniValue importaddress(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 4)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"importaddress",
|
||||
@ -278,6 +274,9 @@ UniValue importaddress(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
std::string strLabel;
|
||||
if (!request.params[1].isNull())
|
||||
@ -337,10 +336,6 @@ UniValue importaddress(const JSONRPCRequest& request)
|
||||
|
||||
UniValue importprunedfunds(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 2)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"importprunedfunds",
|
||||
@ -354,6 +349,10 @@ UniValue importprunedfunds(const JSONRPCRequest& request)
|
||||
}.ToString()
|
||||
);
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
CMutableTransaction tx;
|
||||
if (!DecodeHexTx(tx, request.params[0].get_str()))
|
||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
|
||||
@ -404,10 +403,6 @@ UniValue importprunedfunds(const JSONRPCRequest& request)
|
||||
|
||||
UniValue removeprunedfunds(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"removeprunedfunds",
|
||||
@ -423,6 +418,10 @@ UniValue removeprunedfunds(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
auto locked_chain = pwallet->chain().lock();
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
@ -445,10 +444,6 @@ UniValue removeprunedfunds(const JSONRPCRequest& request)
|
||||
|
||||
UniValue importpubkey(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"importpubkey",
|
||||
@ -472,6 +467,9 @@ UniValue importpubkey(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
std::string strLabel;
|
||||
if (!request.params[1].isNull())
|
||||
@ -524,10 +522,6 @@ UniValue importpubkey(const JSONRPCRequest& request)
|
||||
|
||||
UniValue importwallet(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"importwallet",
|
||||
@ -547,6 +541,10 @@ UniValue importwallet(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (pwallet->chain().havePruned()) {
|
||||
// Exit early and print an error.
|
||||
// If a block is pruned after this check, we will import the key(s),
|
||||
@ -688,10 +686,6 @@ UniValue importwallet(const JSONRPCRequest& request)
|
||||
|
||||
UniValue importelectrumwallet(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"importselectrumwallet",
|
||||
@ -711,6 +705,10 @@ UniValue importelectrumwallet(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (fPruneMode)
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Importing wallets is disabled in pruned mode");
|
||||
|
||||
@ -838,10 +836,6 @@ UniValue importelectrumwallet(const JSONRPCRequest& request)
|
||||
|
||||
UniValue dumpprivkey(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"dumpprivkey",
|
||||
@ -860,6 +854,10 @@ UniValue dumpprivkey(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
auto locked_chain = pwallet->chain().lock();
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
@ -883,10 +881,6 @@ UniValue dumpprivkey(const JSONRPCRequest& request)
|
||||
|
||||
UniValue dumphdinfo(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 0)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"dumphdinfo",
|
||||
@ -905,6 +899,10 @@ UniValue dumphdinfo(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
EnsureWalletIsUnlocked(pwallet);
|
||||
@ -930,10 +928,6 @@ UniValue dumphdinfo(const JSONRPCRequest& request)
|
||||
|
||||
UniValue dumpwallet(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"dumpwallet",
|
||||
@ -957,6 +951,10 @@ UniValue dumpwallet(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
auto locked_chain = pwallet->chain().lock();
|
||||
LockAnnotation lock(::cs_main);
|
||||
LOCK(pwallet->cs_wallet);
|
||||
@ -1467,10 +1465,6 @@ static int64_t GetImportTimestamp(const UniValue& data, int64_t now)
|
||||
|
||||
UniValue importmulti(const JSONRPCRequest& mainRequest)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(mainRequest);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (mainRequest.fHelp || mainRequest.params.size() < 1 || mainRequest.params.size() > 2)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"importmulti",
|
||||
@ -1540,6 +1534,10 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
|
||||
|
||||
const UniValue& requests = mainRequest.params[0];
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(mainRequest);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
//Default options
|
||||
bool fRescan = true;
|
||||
|
||||
|
@ -141,10 +141,6 @@ static std::string LabelFromValue(const UniValue& value)
|
||||
|
||||
UniValue getnewaddress(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() > 1)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"getnewaddress",
|
||||
@ -163,6 +159,10 @@ UniValue getnewaddress(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
if (!pwallet->CanGetAddresses()) {
|
||||
@ -192,10 +192,6 @@ UniValue getnewaddress(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue getrawchangeaddress(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() > 0)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"getrawchangeaddress",
|
||||
@ -211,6 +207,10 @@ static UniValue getrawchangeaddress(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
if (!pwallet->CanGetAddresses(true)) {
|
||||
@ -236,10 +236,6 @@ static UniValue getrawchangeaddress(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue setlabel(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 2)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"setlabel",
|
||||
@ -255,6 +251,10 @@ static UniValue setlabel(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
CTxDestination dest = DecodeDestination(request.params[0].get_str());
|
||||
@ -319,10 +319,6 @@ static CTransactionRef SendMoney(interfaces::Chain::Lock& locked_chain, CWallet
|
||||
|
||||
static UniValue sendtoaddress(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 2 || request.params.size() > 9)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"sendtoaddress",
|
||||
@ -357,6 +353,10 @@ static UniValue sendtoaddress(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
pwallet->BlockUntilSyncedToCurrentChain();
|
||||
@ -420,10 +420,6 @@ static UniValue instantsendtoaddress(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue listaddressgroupings(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 0)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"listaddressgroupings",
|
||||
@ -450,6 +446,10 @@ static UniValue listaddressgroupings(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
pwallet->BlockUntilSyncedToCurrentChain();
|
||||
@ -480,10 +480,6 @@ static UniValue listaddressgroupings(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue listaddressbalances(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() > 1)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"listaddressbalances",
|
||||
@ -505,6 +501,10 @@ static UniValue listaddressbalances(const JSONRPCRequest& request)
|
||||
}
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
auto locked_chain = pwallet->chain().lock();
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
@ -526,10 +526,6 @@ static UniValue listaddressbalances(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue signmessage(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 2)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"signmessage",
|
||||
@ -554,6 +550,10 @@ static UniValue signmessage(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
auto locked_chain = pwallet->chain().lock();
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
@ -590,10 +590,6 @@ static UniValue signmessage(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue getreceivedbyaddress(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"getreceivedbyaddress",
|
||||
@ -618,6 +614,10 @@ static UniValue getreceivedbyaddress(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
pwallet->BlockUntilSyncedToCurrentChain();
|
||||
@ -661,10 +661,6 @@ static UniValue getreceivedbyaddress(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue getreceivedbylabel(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"getreceivedbylabel",
|
||||
@ -689,6 +685,10 @@ static UniValue getreceivedbylabel(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
pwallet->BlockUntilSyncedToCurrentChain();
|
||||
@ -729,10 +729,6 @@ static UniValue getreceivedbylabel(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue getbalance(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || (request.params.size() > 4))
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"getbalance",
|
||||
@ -758,6 +754,10 @@ static UniValue getbalance(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
pwallet->BlockUntilSyncedToCurrentChain();
|
||||
@ -793,10 +793,6 @@ static UniValue getbalance(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue getunconfirmedbalance(const JSONRPCRequest &request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() > 0)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"getunconfirmedbalance",
|
||||
@ -806,6 +802,10 @@ static UniValue getunconfirmedbalance(const JSONRPCRequest &request)
|
||||
RPCExamples{""},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
pwallet->BlockUntilSyncedToCurrentChain();
|
||||
@ -819,10 +819,6 @@ static UniValue getunconfirmedbalance(const JSONRPCRequest &request)
|
||||
|
||||
static UniValue sendmany(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
const RPCHelpMan help{"sendmany",
|
||||
"\nSend multiple times. Amounts are double-precision floating point numbers." +
|
||||
HelpRequiringPassphrase() + "\n",
|
||||
@ -870,6 +866,10 @@ static UniValue sendmany(const JSONRPCRequest& request)
|
||||
throw std::runtime_error(help.ToString());
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
pwallet->BlockUntilSyncedToCurrentChain();
|
||||
@ -967,10 +967,6 @@ static UniValue sendmany(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue addmultisigaddress(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
|
||||
{
|
||||
std::string msg =
|
||||
@ -1005,6 +1001,10 @@ static UniValue addmultisigaddress(const JSONRPCRequest& request)
|
||||
throw std::runtime_error(msg);
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
auto locked_chain = pwallet->chain().lock();
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
@ -1203,10 +1203,6 @@ static UniValue ListReceived(interfaces::Chain::Lock& locked_chain, CWallet * co
|
||||
|
||||
static UniValue listreceivedbyaddress(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() > 5)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"listreceivedbyaddress",
|
||||
@ -1244,6 +1240,10 @@ static UniValue listreceivedbyaddress(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
pwallet->BlockUntilSyncedToCurrentChain();
|
||||
@ -1256,10 +1256,6 @@ static UniValue listreceivedbyaddress(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue listreceivedbylabel(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() > 4)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"listreceivedbylabel",
|
||||
@ -1288,6 +1284,10 @@ static UniValue listreceivedbylabel(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
pwallet->BlockUntilSyncedToCurrentChain();
|
||||
@ -1395,10 +1395,6 @@ static void ListTransactions(interfaces::Chain::Lock& locked_chain, CWallet* con
|
||||
|
||||
static UniValue listtransactions(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() > 4)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"listtransactions",
|
||||
@ -1459,6 +1455,10 @@ static UniValue listtransactions(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
pwallet->BlockUntilSyncedToCurrentChain();
|
||||
@ -1518,10 +1518,6 @@ static UniValue listtransactions(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue listsinceblock(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() > 4)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"listsinceblock",
|
||||
@ -1574,6 +1570,10 @@ static UniValue listsinceblock(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
pwallet->BlockUntilSyncedToCurrentChain();
|
||||
@ -1658,10 +1658,6 @@ static UniValue listsinceblock(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue gettransaction(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"gettransaction",
|
||||
@ -1709,6 +1705,10 @@ static UniValue gettransaction(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
pwallet->BlockUntilSyncedToCurrentChain();
|
||||
@ -1754,10 +1754,6 @@ static UniValue gettransaction(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue abandontransaction(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 1) {
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"abandontransaction",
|
||||
@ -1777,6 +1773,10 @@ static UniValue abandontransaction(const JSONRPCRequest& request)
|
||||
}.ToString());
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
pwallet->BlockUntilSyncedToCurrentChain();
|
||||
@ -1800,10 +1800,6 @@ static UniValue abandontransaction(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue backupwallet(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"backupwallet",
|
||||
@ -1818,6 +1814,10 @@ static UniValue backupwallet(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
pwallet->BlockUntilSyncedToCurrentChain();
|
||||
@ -1836,10 +1836,6 @@ static UniValue backupwallet(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue keypoolrefill(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() > 1)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"keypoolrefill",
|
||||
@ -1855,6 +1851,10 @@ static UniValue keypoolrefill(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (pwallet->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS)) {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Error: Private keys are disabled for this wallet");
|
||||
}
|
||||
@ -1883,10 +1883,6 @@ static UniValue keypoolrefill(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue walletpassphrase(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3) {
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"walletpassphrase",
|
||||
@ -1914,6 +1910,10 @@ static UniValue walletpassphrase(const JSONRPCRequest& request)
|
||||
}.ToString());
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
auto locked_chain = pwallet->chain().lock();
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
@ -1981,10 +1981,6 @@ static UniValue walletpassphrase(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue walletpassphrasechange(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 2) {
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"walletpassphrasechange",
|
||||
@ -2001,6 +1997,10 @@ static UniValue walletpassphrasechange(const JSONRPCRequest& request)
|
||||
}.ToString());
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
auto locked_chain = pwallet->chain().lock();
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
@ -2032,10 +2032,6 @@ static UniValue walletpassphrasechange(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue walletlock(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 0) {
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"walletlock",
|
||||
@ -2057,6 +2053,10 @@ static UniValue walletlock(const JSONRPCRequest& request)
|
||||
}.ToString());
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
auto locked_chain = pwallet->chain().lock();
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
@ -2073,10 +2073,6 @@ static UniValue walletlock(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue encryptwallet(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 1) {
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"encryptwallet",
|
||||
@ -2104,6 +2100,10 @@ static UniValue encryptwallet(const JSONRPCRequest& request)
|
||||
}.ToString());
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
auto locked_chain = pwallet->chain().lock();
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
@ -2134,10 +2134,6 @@ static UniValue encryptwallet(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue lockunspent(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"lockunspent",
|
||||
@ -2178,6 +2174,10 @@ static UniValue lockunspent(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
pwallet->BlockUntilSyncedToCurrentChain();
|
||||
@ -2264,10 +2264,6 @@ static UniValue lockunspent(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue listlockunspent(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() > 0)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"listlockunspent",
|
||||
@ -2298,6 +2294,10 @@ static UniValue listlockunspent(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
auto locked_chain = pwallet->chain().lock();
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
@ -2319,10 +2319,6 @@ static UniValue listlockunspent(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue settxfee(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 1) {
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"settxfee",
|
||||
@ -2340,6 +2336,10 @@ static UniValue settxfee(const JSONRPCRequest& request)
|
||||
}.ToString());
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
auto locked_chain = pwallet->chain().lock();
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
@ -2359,10 +2359,6 @@ static UniValue settxfee(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue setcoinjoinrounds(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"setcoinjoinrounds",
|
||||
@ -2379,6 +2375,9 @@ static UniValue setcoinjoinrounds(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
|
||||
int nRounds = request.params[0].get_int();
|
||||
|
||||
if (nRounds > MAX_COINJOIN_ROUNDS || nRounds < MIN_COINJOIN_ROUNDS)
|
||||
@ -2391,10 +2390,6 @@ static UniValue setcoinjoinrounds(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue setcoinjoinamount(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"setcoinjoinamount",
|
||||
@ -2411,6 +2406,9 @@ static UniValue setcoinjoinamount(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
|
||||
int nAmount = request.params[0].get_int();
|
||||
|
||||
if (nAmount > MAX_COINJOIN_AMOUNT || nAmount < MIN_COINJOIN_AMOUNT)
|
||||
@ -2423,10 +2421,6 @@ static UniValue setcoinjoinamount(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue getwalletinfo(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 0)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"getwalletinfo",
|
||||
@ -2472,6 +2466,10 @@ static UniValue getwalletinfo(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
pwallet->BlockUntilSyncedToCurrentChain();
|
||||
@ -2600,10 +2598,6 @@ static UniValue listwallets(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue upgradetohd(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"upgradetohd",
|
||||
@ -2623,6 +2617,10 @@ static UniValue upgradetohd(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
auto locked_chain = pwallet->chain().lock();
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
@ -2899,10 +2897,6 @@ static UniValue unloadwallet(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue listunspent(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() > 5)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"listunspent",
|
||||
@ -2962,6 +2956,10 @@ static UniValue listunspent(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
int nMinDepth = 1;
|
||||
if (!request.params[0].isNull()) {
|
||||
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
|
||||
@ -3206,10 +3204,6 @@ void FundTransaction(CWallet* const pwallet, CMutableTransaction& tx, CAmount& f
|
||||
|
||||
static UniValue fundrawtransaction(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"fundrawtransaction",
|
||||
@ -3273,6 +3267,10 @@ static UniValue fundrawtransaction(const JSONRPCRequest& request)
|
||||
|
||||
RPCTypeCheck(request.params, {UniValue::VSTR, UniValueType(), UniValue::VBOOL});
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// parse hex string from parameter
|
||||
CMutableTransaction tx;
|
||||
if (!DecodeHexTx(tx, request.params[0].get_str())) {
|
||||
@ -3293,10 +3291,6 @@ static UniValue fundrawtransaction(const JSONRPCRequest& request)
|
||||
|
||||
UniValue signrawtransactionwithwallet(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"signrawtransactionwithwallet",
|
||||
@ -3353,6 +3347,10 @@ UniValue signrawtransactionwithwallet(const JSONRPCRequest& request)
|
||||
|
||||
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR, UniValue::VSTR}, true);
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
CMutableTransaction mtx;
|
||||
if (!DecodeHexTx(mtx, request.params[0].get_str())) {
|
||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
|
||||
@ -3376,10 +3374,6 @@ UniValue signrawtransactionwithwallet(const JSONRPCRequest& request)
|
||||
#if ENABLE_MINER
|
||||
UniValue generate(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"generate",
|
||||
@ -3398,6 +3392,10 @@ UniValue generate(const JSONRPCRequest& request)
|
||||
}.ToString());
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
int num_generate = request.params[0].get_int();
|
||||
uint64_t max_tries = 1000000;
|
||||
if (!request.params[1].isNull()) {
|
||||
@ -3428,10 +3426,6 @@ UniValue generate(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue rescanblockchain(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() > 2) {
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"rescanblockchain",
|
||||
@ -3455,6 +3449,10 @@ static UniValue rescanblockchain(const JSONRPCRequest& request)
|
||||
}.ToString());
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
WalletRescanReserver reserver(pwallet);
|
||||
if (!reserver.reserve()) {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet is currently rescanning. Abort existing rescan or wait.");
|
||||
@ -3582,10 +3580,6 @@ static UniValue AddressBookDataToJSON(const CAddressBookData& data, const bool v
|
||||
|
||||
UniValue getaddressinfo(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 1) {
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"getaddressinfo",
|
||||
@ -3635,6 +3629,10 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
|
||||
}.ToString());
|
||||
}
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
@ -3706,10 +3704,6 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue getaddressesbylabel(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"getaddressesbylabel",
|
||||
@ -3732,6 +3726,10 @@ static UniValue getaddressesbylabel(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
std::string label = LabelFromValue(request.params[0]);
|
||||
@ -3764,10 +3762,6 @@ static UniValue getaddressesbylabel(const JSONRPCRequest& request)
|
||||
|
||||
static UniValue listlabels(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() > 1)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"listlabels",
|
||||
@ -3793,6 +3787,10 @@ static UniValue listlabels(const JSONRPCRequest& request)
|
||||
},
|
||||
}.ToString());
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
std::string purpose;
|
||||
@ -3831,10 +3829,6 @@ UniValue importelectrumwallet(const JSONRPCRequest& request);
|
||||
|
||||
UniValue walletprocesspsbt(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 4)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"walletprocesspsbt",
|
||||
@ -3867,6 +3861,10 @@ UniValue walletprocesspsbt(const JSONRPCRequest& request)
|
||||
|
||||
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL, UniValue::VSTR});
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
// Unserialize the transaction
|
||||
PartiallySignedTransaction psbtx;
|
||||
std::string error;
|
||||
@ -3901,10 +3899,6 @@ UniValue walletprocesspsbt(const JSONRPCRequest& request)
|
||||
|
||||
UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
|
||||
{
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
if (request.fHelp || request.params.size() < 2 || request.params.size() > 5)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"walletcreatefundedpsbt",
|
||||
@ -3987,6 +3981,10 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
|
||||
}, true
|
||||
);
|
||||
|
||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!wallet) return NullUniValue;
|
||||
CWallet* const pwallet = wallet.get();
|
||||
|
||||
CAmount fee;
|
||||
int change_position;
|
||||
CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2]);
|
||||
|
@ -17,6 +17,8 @@ class HelpRpcTest(BitcoinTestFramework):
|
||||
def run_test(self):
|
||||
self.test_categories()
|
||||
self.dump_help()
|
||||
if self.is_wallet_compiled():
|
||||
self.wallet_help()
|
||||
|
||||
def test_categories(self):
|
||||
node = self.nodes[0]
|
||||
@ -52,6 +54,11 @@ class HelpRpcTest(BitcoinTestFramework):
|
||||
# Make sure the node can generate the help at runtime without crashing
|
||||
f.write(self.nodes[0].help(call))
|
||||
|
||||
def wallet_help(self):
|
||||
assert 'getnewaddress ( "label" )' in self.nodes[0].help('getnewaddress')
|
||||
self.restart_node(0, extra_args=['-nowallet=1'])
|
||||
assert 'getnewaddress ( "label" )' in self.nodes[0].help('getnewaddress')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
HelpRpcTest().main()
|
||||
|
Loading…
Reference in New Issue
Block a user