Skip to content

Commit 22d329a

Browse files
committed
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.
1 parent 7b3587b commit 22d329a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/wallet/rpcdump.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static std::string DecodeDumpString(const std::string &str) {
5454
return ret.str();
5555
}
5656

57-
static bool GetWalletAddressesForKey(LegacyScriptPubKeyMan* spk_man, CWallet* const pwallet, const CKeyID& keyid, std::string& strAddr, std::string& strLabel) EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet)
57+
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)
5858
{
5959
bool fLabelFound = false;
6060
CKey key;
@@ -65,7 +65,7 @@ static bool GetWalletAddressesForKey(LegacyScriptPubKeyMan* spk_man, CWallet* co
6565
strAddr += ",";
6666
}
6767
strAddr += EncodeDestination(dest);
68-
strLabel = EncodeDumpString(pwallet->mapAddressBook[dest].name);
68+
strLabel = EncodeDumpString(pwallet->mapAddressBook.at(dest).name);
6969
fLabelFound = true;
7070
}
7171
}
@@ -676,7 +676,7 @@ UniValue importwallet(const JSONRPCRequest& request)
676676
UniValue dumpprivkey(const JSONRPCRequest& request)
677677
{
678678
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
679-
CWallet* const pwallet = wallet.get();
679+
const CWallet* const pwallet = wallet.get();
680680
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
681681
return NullUniValue;
682682
}
@@ -724,7 +724,7 @@ UniValue dumpprivkey(const JSONRPCRequest& request)
724724
UniValue dumpwallet(const JSONRPCRequest& request)
725725
{
726726
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
727-
CWallet* const pwallet = wallet.get();
727+
const CWallet* const pwallet = wallet.get();
728728
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
729729
return NullUniValue;
730730
}

0 commit comments

Comments
 (0)