Skip to content

Commit 9f82134

Browse files
committed
Add friendly output to dumpwallet refs #9564
1 parent de01da7 commit 9f82134

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/wallet/rpcdump.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,11 @@ UniValue dumpwallet(const JSONRPCRequest& request)
579579
"dumpwallet \"filename\"\n"
580580
"\nDumps all wallet keys in a human-readable format.\n"
581581
"\nArguments:\n"
582-
"1. \"filename\" (string, required) The filename\n"
582+
"1. \"filename\" (string, required) The filename with path (either absolute or relative to bitcoind)\n"
583+
"\nResult:\n"
584+
"{ (json object)\n"
585+
" \"filename\" : { (string) The filename with full absolute path\n"
586+
"}\n"
583587
"\nExamples:\n"
584588
+ HelpExampleCli("dumpwallet", "\"test\"")
585589
+ HelpExampleRpc("dumpwallet", "\"test\"")
@@ -590,7 +594,9 @@ UniValue dumpwallet(const JSONRPCRequest& request)
590594
EnsureWalletIsUnlocked(pwallet);
591595

592596
std::ofstream file;
593-
file.open(request.params[0].get_str().c_str());
597+
boost::filesystem::path filepath = request.params[0].get_str();
598+
filepath = boost::filesystem::absolute(filepath);
599+
file.open(filepath.string().c_str());
594600
if (!file.is_open())
595601
throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot open wallet dump file");
596602

@@ -655,7 +661,11 @@ UniValue dumpwallet(const JSONRPCRequest& request)
655661
file << "\n";
656662
file << "# End of dump\n";
657663
file.close();
658-
return NullUniValue;
664+
665+
UniValue reply(UniValue::VOBJ);
666+
reply.push_back(Pair("filename", filepath.string()));
667+
668+
return reply;
659669
}
660670

661671

0 commit comments

Comments
 (0)