Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 3,284 Lines • ▼ Show 20 Lines | if (!RemoveWallet(wallet)) { | ||||
throw JSONRPCError(RPC_MISC_ERROR, "Requested wallet already unloaded"); | throw JSONRPCError(RPC_MISC_ERROR, "Requested wallet already unloaded"); | ||||
} | } | ||||
UnloadWallet(std::move(wallet)); | UnloadWallet(std::move(wallet)); | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
static UniValue resendwallettransactions(const Config &config, | |||||
const JSONRPCRequest &request) { | |||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | |||||
CWallet *const pwallet = wallet.get(); | |||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | |||||
return NullUniValue; | |||||
} | |||||
if (request.fHelp || request.params.size() != 0) { | |||||
throw std::runtime_error(RPCHelpMan{ | |||||
"resendwallettransactions", | |||||
"Immediately re-broadcast unconfirmed wallet transactions to all " | |||||
"peers.\n" | |||||
"Intended only for testing; the wallet code periodically " | |||||
"re-broadcasts\n", | |||||
{}, | |||||
RPCResult{ | |||||
"Returns an RPC error if -walletbroadcast is set to false.\n" | |||||
"Returns array of transaction ids that were re-broadcast.\n"}, | |||||
RPCExamples{""}, | |||||
} | |||||
.ToString()); | |||||
} | |||||
if (!pwallet->chain().p2pEnabled()) { | |||||
throw JSONRPCError( | |||||
RPC_CLIENT_P2P_DISABLED, | |||||
"Error: Peer-to-peer functionality missing or disabled"); | |||||
} | |||||
auto locked_chain = pwallet->chain().lock(); | |||||
LOCK(pwallet->cs_wallet); | |||||
if (!pwallet->GetBroadcastTransactions()) { | |||||
throw JSONRPCError(RPC_WALLET_ERROR, "Error: Wallet transaction " | |||||
"broadcasting is disabled with " | |||||
"-walletbroadcast"); | |||||
} | |||||
std::vector<uint256> txids = | |||||
pwallet->ResendWalletTransactionsBefore(*locked_chain, GetTime()); | |||||
UniValue result(UniValue::VARR); | |||||
for (const uint256 &txid : txids) { | |||||
result.push_back(txid.ToString()); | |||||
} | |||||
return result; | |||||
} | |||||
static UniValue listunspent(const Config &config, | static UniValue listunspent(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,516 Lines • ▼ Show 20 Lines | static UniValue walletcreatefundedpsbt(const Config &config, | ||||
return result; | return result; | ||||
} | } | ||||
// clang-format off | // clang-format off | ||||
static const CRPCCommand commands[] = { | static const CRPCCommand commands[] = { | ||||
// category name actor (function) argNames | // category name actor (function) argNames | ||||
// ------------------- ------------------------ ---------------------- ---------- | // ------------------- ------------------------ ---------------------- ---------- | ||||
{ "generating", "generate", generate, {"nblocks","maxtries"} }, | { "generating", "generate", generate, {"nblocks","maxtries"} }, | ||||
{ "hidden", "resendwallettransactions", resendwallettransactions, {} }, | |||||
{ "rawtransactions", "fundrawtransaction", fundrawtransaction, {"hexstring","options"} }, | { "rawtransactions", "fundrawtransaction", fundrawtransaction, {"hexstring","options"} }, | ||||
{ "wallet", "abandontransaction", abandontransaction, {"txid"} }, | { "wallet", "abandontransaction", abandontransaction, {"txid"} }, | ||||
{ "wallet", "addmultisigaddress", addmultisigaddress, {"nrequired","keys","label"} }, | { "wallet", "addmultisigaddress", addmultisigaddress, {"nrequired","keys","label"} }, | ||||
{ "wallet", "backupwallet", backupwallet, {"destination"} }, | { "wallet", "backupwallet", backupwallet, {"destination"} }, | ||||
{ "wallet", "createwallet", createwallet, {"wallet_name", "disable_private_keys", "blank"} }, | { "wallet", "createwallet", createwallet, {"wallet_name", "disable_private_keys", "blank"} }, | ||||
{ "wallet", "encryptwallet", encryptwallet, {"passphrase"} }, | { "wallet", "encryptwallet", encryptwallet, {"passphrase"} }, | ||||
{ "wallet", "getaddressesbylabel", getaddressesbylabel, {"label"} }, | { "wallet", "getaddressesbylabel", getaddressesbylabel, {"label"} }, | ||||
{ "wallet", "getaddressinfo", getaddressinfo, {"address"} }, | { "wallet", "getaddressinfo", getaddressinfo, {"address"} }, | ||||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |