mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-05-17 23:56:39 +00:00
wallet: use constant CWallets in rpcdump.cpp
* GetWalletAddressesForKey is, as the name implies, immutable; the one change besides the parameter constness is a [] -> .at() change, to a verified-existing key. * dumpprivkey and dumpwallet are both similarly immutable, for obvious reasons.
This commit is contained in:
parent
7b3587b29d
commit
22d329ad0e
@ -54,7 +54,7 @@ static std::string DecodeDumpString(const std::string &str) {
|
|||||||
return ret.str();
|
return ret.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GetWalletAddressesForKey(LegacyScriptPubKeyMan* spk_man, CWallet* const pwallet, const CKeyID& keyid, std::string& strAddr, std::string& strLabel) EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet)
|
static bool GetWalletAddressesForKey(LegacyScriptPubKeyMan* spk_man, const CWallet* const pwallet, const CKeyID& keyid, std::string& strAddr, std::string& strLabel) EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet)
|
||||||
{
|
{
|
||||||
bool fLabelFound = false;
|
bool fLabelFound = false;
|
||||||
CKey key;
|
CKey key;
|
||||||
@ -65,7 +65,7 @@ static bool GetWalletAddressesForKey(LegacyScriptPubKeyMan* spk_man, CWallet* co
|
|||||||
strAddr += ",";
|
strAddr += ",";
|
||||||
}
|
}
|
||||||
strAddr += EncodeDestination(dest);
|
strAddr += EncodeDestination(dest);
|
||||||
strLabel = EncodeDumpString(pwallet->mapAddressBook[dest].name);
|
strLabel = EncodeDumpString(pwallet->mapAddressBook.at(dest).name);
|
||||||
fLabelFound = true;
|
fLabelFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -676,7 +676,7 @@ UniValue importwallet(const JSONRPCRequest& request)
|
|||||||
UniValue dumpprivkey(const JSONRPCRequest& request)
|
UniValue dumpprivkey(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;
|
||||||
}
|
}
|
||||||
@ -724,7 +724,7 @@ UniValue dumpprivkey(const JSONRPCRequest& request)
|
|||||||
UniValue dumpwallet(const JSONRPCRequest& request)
|
UniValue dumpwallet(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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user