|
|
@ -603,7 +603,11 @@ UniValue dumpwallet(const JSONRPCRequest& request) |
|
|
|
"dumpwallet \"filename\"\n" |
|
|
|
"dumpwallet \"filename\"\n" |
|
|
|
"\nDumps all wallet keys in a human-readable format.\n" |
|
|
|
"\nDumps all wallet keys in a human-readable format.\n" |
|
|
|
"\nArguments:\n" |
|
|
|
"\nArguments:\n" |
|
|
|
"1. \"filename\" (string, required) The filename\n" |
|
|
|
"1. \"filename\" (string, required) The filename with path (either absolute or relative to bitcoind)\n" |
|
|
|
|
|
|
|
"\nResult:\n" |
|
|
|
|
|
|
|
"{ (json object)\n" |
|
|
|
|
|
|
|
" \"filename\" : { (string) The filename with full absolute path\n" |
|
|
|
|
|
|
|
"}\n" |
|
|
|
"\nExamples:\n" |
|
|
|
"\nExamples:\n" |
|
|
|
+ HelpExampleCli("dumpwallet", "\"test\"") |
|
|
|
+ HelpExampleCli("dumpwallet", "\"test\"") |
|
|
|
+ HelpExampleRpc("dumpwallet", "\"test\"") |
|
|
|
+ HelpExampleRpc("dumpwallet", "\"test\"") |
|
|
@ -614,7 +618,9 @@ UniValue dumpwallet(const JSONRPCRequest& request) |
|
|
|
EnsureWalletIsUnlocked(pwallet); |
|
|
|
EnsureWalletIsUnlocked(pwallet); |
|
|
|
|
|
|
|
|
|
|
|
std::ofstream file; |
|
|
|
std::ofstream file; |
|
|
|
file.open(request.params[0].get_str().c_str()); |
|
|
|
boost::filesystem::path filepath = request.params[0].get_str(); |
|
|
|
|
|
|
|
filepath = boost::filesystem::absolute(filepath); |
|
|
|
|
|
|
|
file.open(filepath.string().c_str()); |
|
|
|
if (!file.is_open()) |
|
|
|
if (!file.is_open()) |
|
|
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot open wallet dump file"); |
|
|
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot open wallet dump file"); |
|
|
|
|
|
|
|
|
|
|
@ -679,7 +685,11 @@ UniValue dumpwallet(const JSONRPCRequest& request) |
|
|
|
file << "\n"; |
|
|
|
file << "\n"; |
|
|
|
file << "# End of dump\n"; |
|
|
|
file << "# End of dump\n"; |
|
|
|
file.close(); |
|
|
|
file.close(); |
|
|
|
return NullUniValue; |
|
|
|
|
|
|
|
|
|
|
|
UniValue reply(UniValue::VOBJ); |
|
|
|
|
|
|
|
reply.push_back(Pair("filename", filepath.string())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return reply; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|