aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpcdump.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/rpcdump.cpp')
-rw-r--r--src/wallet/rpcdump.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
index e4d0a3fa6d..e1d8f51c4a 100644
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -60,12 +60,13 @@ static bool GetWalletAddressesForKey(LegacyScriptPubKeyMan* spk_man, const CWall
CKey key;
spk_man->GetKey(keyid, key);
for (const auto& dest : GetAllDestinationsForKey(key.GetPubKey())) {
- if (pwallet->mapAddressBook.count(dest)) {
+ const auto* address_book_entry = pwallet->FindAddressBookEntry(dest);
+ if (address_book_entry) {
if (!strAddr.empty()) {
strAddr += ",";
}
strAddr += EncodeDestination(dest);
- strLabel = EncodeDumpString(pwallet->mapAddressBook.at(dest).name);
+ strLabel = EncodeDumpString(address_book_entry->name);
fLabelFound = true;
}
}
@@ -168,7 +169,7 @@ UniValue importprivkey(const JSONRPCRequest& request)
// label all new addresses, and label existing addresses if a
// label was passed.
for (const auto& dest : GetAllDestinationsForKey(pubkey)) {
- if (!request.params[1].isNull() || pwallet->mapAddressBook.count(dest) == 0) {
+ if (!request.params[1].isNull() || !pwallet->FindAddressBookEntry(dest)) {
pwallet->SetAddressBook(dest, strLabel, "receive");
}
}