Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcdump.cpp
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | for (unsigned int pos = 0; pos < str.length(); pos++) { | ||||
} | } | ||||
ret << c; | ret << c; | ||||
} | } | ||||
return ret.str(); | return ret.str(); | ||||
} | } | ||||
static bool | static bool | ||||
GetWalletAddressesForKey(const Config &config, LegacyScriptPubKeyMan *spk_man, | GetWalletAddressesForKey(const Config &config, LegacyScriptPubKeyMan *spk_man, | ||||
CWallet *const pwallet, const CKeyID &keyid, | const CWallet *const pwallet, const CKeyID &keyid, | ||||
std::string &strAddr, std::string &strLabel) | std::string &strAddr, std::string &strLabel) | ||||
EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet) { | EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet) { | ||||
bool fLabelFound = false; | bool fLabelFound = false; | ||||
CKey key; | CKey key; | ||||
spk_man->GetKey(keyid, key); | spk_man->GetKey(keyid, key); | ||||
for (const auto &dest : GetAllDestinationsForKey(key.GetPubKey())) { | for (const auto &dest : GetAllDestinationsForKey(key.GetPubKey())) { | ||||
const auto *address_book_entry = pwallet->FindAddressBookEntry(dest); | const auto *address_book_entry = pwallet->FindAddressBookEntry(dest); | ||||
if (address_book_entry) { | if (address_book_entry) { | ||||
▲ Show 20 Lines • Show All 740 Lines • ▼ Show 20 Lines | if (!fGood) { | ||||
"Error adding some keys/scripts to wallet"); | "Error adding some keys/scripts to wallet"); | ||||
} | } | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
UniValue dumpprivkey(const Config &config, const JSONRPCRequest &request) { | UniValue dumpprivkey(const Config &config, const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | const CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"dumpprivkey", | "dumpprivkey", | ||||
"Reveals the private key corresponding to 'address'.\n" | "Reveals the private key corresponding to 'address'.\n" | ||||
"Then the importprivkey can be used with this output\n", | "Then the importprivkey can be used with this output\n", | ||||
▲ Show 20 Lines • Show All 1,003 Lines • Show Last 20 Lines |