MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / backupwallet

Function backupwallet

src/wallet/rpcwallet.cpp:2470–2502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2468
2469
2470static UniValue backupwallet(const JSONRPCRequest& request)
2471{
2472 std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
2473 CWallet* const pwallet = wallet.get();
2474
2475 if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
2476 return NullUniValue;
2477 }
2478
2479 if (request.fHelp || request.params.size() != 1)
2480 throw std::runtime_error(
2481 "backupwallet \"destination\"\n"
2482 "\nSafely copies current wallet file to destination, which can be a directory or a path with filename.\n"
2483 "\nArguments:\n"
2484 "1. \"destination\" (string) The destination directory or file\n"
2485 "\nExamples:\n"
2486 + HelpExampleCli("backupwallet", "\"backup.dat\"")
2487 + HelpExampleRpc("backupwallet", "\"backup.dat\"")
2488 );
2489
2490 // Make sure the results are valid at least up to the most recent block
2491 // the user could have gotten from another RPC command prior to now
2492 pwallet->BlockUntilSyncedToCurrentChain();
2493
2494 LOCK2(cs_main, pwallet->cs_wallet);
2495
2496 std::string strDest = request.params[0].get_str();
2497 if (!pwallet->BackupWallet(strDest)) {
2498 throw JSONRPCError(RPC_WALLET_ERROR, "Error: Wallet backup failed!");
2499 }
2500
2501 return NullUniValue;
2502}
2503
2504
2505static UniValue keypoolrefill(const JSONRPCRequest& request)

Callers

nothing calls this directly

Calls 9

EnsureWalletIsAvailableFunction · 0.85
HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
JSONRPCErrorFunction · 0.85
getMethod · 0.80
BackupWalletMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected