Skip to content

Commit

Permalink
Add CScripts to dumpwallet RPC
Browse files Browse the repository at this point in the history
  • Loading branch information
meshcollider committed Dec 20, 2017
1 parent cdc260a commit b702ae8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/wallet/rpcdump.cpp
Expand Up @@ -640,6 +640,8 @@ UniValue dumpwallet(const JSONRPCRequest& request)
const std::map<CKeyID, int64_t>& mapKeyPool = pwallet->GetAllReserveKeys();
pwallet->GetKeyBirthTimes(mapKeyBirth);

std::set<CScriptID> scripts = pwallet->GetCScripts();

// sort time/key pairs
std::vector<std::pair<int64_t, CKeyID> > vKeyBirth;
for (const auto& entry : mapKeyBirth) {
Expand Down Expand Up @@ -694,6 +696,15 @@ UniValue dumpwallet(const JSONRPCRequest& request)
}
}
file << "\n";
for (const CScriptID &scriptid : scripts) {
CScript script;
std::string address = EncodeDestination(scriptid);
if(pwallet->GetCScript(scriptid, script)) {
file << strprintf("%s 0 script=1", HexStr(script.begin(), script.end()));
file << strprintf(" # addr=%s\n", address);
}
}
file << "\n";
file << "# End of dump\n";
file.close();

Expand Down

0 comments on commit b702ae8

Please sign in to comment.