Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show some additional info about the wallet dumped via dumpwallet #2191

Merged
merged 1 commit into from
Jul 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/wallet/rpcdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,12 @@ UniValue dumpwallet(const JSONRPCRequest& request)
file << strprintf("# mined on %s\n", EncodeDumpTime(chainActive.Tip()->GetBlockTime()));
file << "\n";

UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("dashcoreversion", CLIENT_BUILD));
obj.push_back(Pair("lastblockheight", chainActive.Height()));
obj.push_back(Pair("lastblockhash", chainActive.Tip()->GetBlockHash().ToString()));
obj.push_back(Pair("lastblocktime", EncodeDumpTime(chainActive.Tip()->GetBlockTime())));

// add the base58check encoded extended master if the wallet uses HD
CHDChain hdChainCurrent;
if (pwalletMain->GetHDChain(hdChainCurrent))
Expand Down Expand Up @@ -813,6 +819,7 @@ UniValue dumpwallet(const JSONRPCRequest& request)
file << "# WARNING: ACCOUNT " << i << " IS MISSING!" << "\n\n";
}
}
obj.push_back(Pair("hdaccounts", int(hdChainCurrent.CountAccounts())));
}

for (std::vector<std::pair<int64_t, CKeyID> >::const_iterator it = vKeyBirth.begin(); it != vKeyBirth.end(); it++) {
Expand All @@ -835,7 +842,13 @@ UniValue dumpwallet(const JSONRPCRequest& request)
file << "\n";
file << "# End of dump\n";
file.close();
return NullUniValue;

std::string strWarning = strprintf(_("%s file contains all private keys from this wallet. Do not share it with anyone!"), request.params[0].get_str().c_str());
obj.push_back(Pair("keys", int(vKeyBirth.size())));
obj.push_back(Pair("file", request.params[0].get_str().c_str()));
obj.push_back(Pair("warning", strWarning));

return obj;
}


Expand Down