Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcdump.cpp
Show First 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | bool fRescan = true; | ||||
strLabel = request.params[1].get_str(); | strLabel = request.params[1].get_str(); | ||||
} | } | ||||
// Whether to perform rescan after import | // Whether to perform rescan after import | ||||
if (!request.params[2].isNull()) { | if (!request.params[2].isNull()) { | ||||
fRescan = request.params[2].get_bool(); | fRescan = request.params[2].get_bool(); | ||||
} | } | ||||
if (fRescan && pwallet->chain().getPruneMode()) { | if (fRescan && pwallet->chain().havePruned()) { | ||||
// Exit early and print an error. | |||||
// If a block is pruned after this check, we will import the key(s), | |||||
// but fail the rescan with a generic error. | |||||
throw JSONRPCError(RPC_WALLET_ERROR, | throw JSONRPCError(RPC_WALLET_ERROR, | ||||
"Rescan is disabled in pruned mode"); | "Rescan is disabled when blocks are pruned"); | ||||
} | } | ||||
if (fRescan && !reserver.reserve()) { | if (fRescan && !reserver.reserve()) { | ||||
throw JSONRPCError(RPC_WALLET_ERROR, | throw JSONRPCError(RPC_WALLET_ERROR, | ||||
"Wallet is currently rescanning. Abort existing " | "Wallet is currently rescanning. Abort existing " | ||||
"rescan or wait."); | "rescan or wait."); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | UniValue importaddress(const Config &config, const JSONRPCRequest &request) { | ||||
} | } | ||||
// Whether to perform rescan after import | // Whether to perform rescan after import | ||||
bool fRescan = true; | bool fRescan = true; | ||||
if (!request.params[2].isNull()) { | if (!request.params[2].isNull()) { | ||||
fRescan = request.params[2].get_bool(); | fRescan = request.params[2].get_bool(); | ||||
} | } | ||||
if (fRescan && pwallet->chain().getPruneMode()) { | if (fRescan && pwallet->chain().havePruned()) { | ||||
// Exit early and print an error. | |||||
// If a block is pruned after this check, we will import the key(s), | |||||
// but fail the rescan with a generic error. | |||||
throw JSONRPCError(RPC_WALLET_ERROR, | throw JSONRPCError(RPC_WALLET_ERROR, | ||||
"Rescan is disabled in pruned mode"); | "Rescan is disabled when blocks are pruned"); | ||||
} | } | ||||
WalletRescanReserver reserver(pwallet); | WalletRescanReserver reserver(pwallet); | ||||
if (fRescan && !reserver.reserve()) { | if (fRescan && !reserver.reserve()) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_WALLET_ERROR, | RPC_WALLET_ERROR, | ||||
"Wallet is currently rescanning. Abort existing rescan or wait."); | "Wallet is currently rescanning. Abort existing rescan or wait."); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 228 Lines • ▼ Show 20 Lines | UniValue importpubkey(const Config &config, const JSONRPCRequest &request) { | ||||
} | } | ||||
// Whether to perform rescan after import | // Whether to perform rescan after import | ||||
bool fRescan = true; | bool fRescan = true; | ||||
if (!request.params[2].isNull()) { | if (!request.params[2].isNull()) { | ||||
fRescan = request.params[2].get_bool(); | fRescan = request.params[2].get_bool(); | ||||
} | } | ||||
if (fRescan && pwallet->chain().getPruneMode()) { | if (fRescan && pwallet->chain().havePruned()) { | ||||
// Exit early and print an error. | |||||
// If a block is pruned after this check, we will import the key(s), | |||||
// but fail the rescan with a generic error. | |||||
throw JSONRPCError(RPC_WALLET_ERROR, | throw JSONRPCError(RPC_WALLET_ERROR, | ||||
"Rescan is disabled in pruned mode"); | "Rescan is disabled when blocks are pruned"); | ||||
} | } | ||||
WalletRescanReserver reserver(pwallet); | WalletRescanReserver reserver(pwallet); | ||||
if (fRescan && !reserver.reserve()) { | if (fRescan && !reserver.reserve()) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_WALLET_ERROR, | RPC_WALLET_ERROR, | ||||
"Wallet is currently rescanning. Abort existing rescan or wait."); | "Wallet is currently rescanning. Abort existing rescan or wait."); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
HelpExampleCli("dumpwallet", "\"test\"") + | HelpExampleCli("dumpwallet", "\"test\"") + | ||||
"\nImport the wallet\n" + | "\nImport the wallet\n" + | ||||
HelpExampleCli("importwallet", "\"test\"") + | HelpExampleCli("importwallet", "\"test\"") + | ||||
"\nImport using the json rpc call\n" + | "\nImport using the json rpc call\n" + | ||||
HelpExampleRpc("importwallet", "\"test\"")}, | HelpExampleRpc("importwallet", "\"test\"")}, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
if (pwallet->chain().getPruneMode()) { | if (pwallet->chain().havePruned()) { | ||||
throw JSONRPCError(RPC_WALLET_ERROR, | // Exit early and print an error. | ||||
"Importing wallets is disabled in pruned mode"); | // If a block is pruned after this check, we will import the key(s), | ||||
// but fail the rescan with a generic error. | |||||
throw JSONRPCError( | |||||
RPC_WALLET_ERROR, | |||||
"Importing wallets is disabled when blocks are pruned"); | |||||
} | } | ||||
WalletRescanReserver reserver(pwallet); | WalletRescanReserver reserver(pwallet); | ||||
if (!reserver.reserve()) { | if (!reserver.reserve()) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_WALLET_ERROR, | RPC_WALLET_ERROR, | ||||
"Wallet is currently rescanning. Abort existing rescan or wait."); | "Wallet is currently rescanning. Abort existing rescan or wait."); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,156 Lines • Show Last 20 Lines |