diff options
author | aideca <aideca@users.noreply.github.com> | 2017-02-10 12:47:53 +0000 |
---|---|---|
committer | aideca <aideca@users.noreply.github.com> | 2017-04-13 08:39:07 +0000 |
commit | 9f821347793b6523fd0b609a198e0e83e76affbf (patch) | |
tree | 0caeef62f6d1364f9f077be74d148bfb9cb99dcb /src/wallet | |
parent | de01da7cad32c505624e7ddcf9b062374fe17b95 (diff) |
Add friendly output to dumpwallet refs #9564
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/rpcdump.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 7ff9e7ae58..60666718e3 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -579,7 +579,11 @@ UniValue dumpwallet(const JSONRPCRequest& request) "dumpwallet \"filename\"\n" "\nDumps all wallet keys in a human-readable format.\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" + HelpExampleCli("dumpwallet", "\"test\"") + HelpExampleRpc("dumpwallet", "\"test\"") @@ -590,7 +594,9 @@ UniValue dumpwallet(const JSONRPCRequest& request) EnsureWalletIsUnlocked(pwallet); 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()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot open wallet dump file"); @@ -655,7 +661,11 @@ UniValue dumpwallet(const JSONRPCRequest& request) file << "\n"; file << "# End of dump\n"; file.close(); - return NullUniValue; + + UniValue reply(UniValue::VOBJ); + reply.push_back(Pair("filename", filepath.string())); + + return reply; } |