aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2020-02-22 04:27:03 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2020-04-02 16:37:41 +0000
commit6d2905f57aaeb3ec3b63d31043f7673ca10003f2 (patch)
tree21fc53848fc75935cd77f95faec2fbd5fea375fa /src
parentc751d886f499257627b308b11ffaa51c22db6cc0 (diff)
downloadbitcoin-6d2905f57aaeb3ec3b63d31043f7673ca10003f2.tar.xz
Wallet: Avoid unnecessary/redundant m_address_book lookups
Diffstat (limited to 'src')
-rw-r--r--src/wallet/rpcdump.cpp2
-rw-r--r--src/wallet/rpcwallet.cpp8
2 files changed, 5 insertions, 5 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
index 40ea51e464..e1d8f51c4a 100644
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -66,7 +66,7 @@ static bool GetWalletAddressesForKey(LegacyScriptPubKeyMan* spk_man, const CWall
strAddr += ",";
}
strAddr += EncodeDestination(dest);
- strLabel = EncodeDumpString(pwallet->m_address_book.at(dest).name);
+ strLabel = EncodeDumpString(address_book_entry->name);
fLabelFound = true;
}
}
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 464371a15f..a7f7d357bc 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -507,7 +507,7 @@ static UniValue listaddressgroupings(const JSONRPCRequest& request)
{
const auto* address_book_entry = pwallet->FindAddressBookEntry(address);
if (address_book_entry) {
- addressInfo.push_back(pwallet->m_address_book.find(address)->second.name);
+ addressInfo.push_back(address_book_entry->name);
}
}
jsonGrouping.push_back(addressInfo);
@@ -1317,7 +1317,7 @@ static void ListTransactions(interfaces::Chain::Lock& locked_chain, const CWalle
entry.pushKV("amount", ValueFromAmount(-s.amount));
const auto* address_book_entry = pwallet->FindAddressBookEntry(s.destination);
if (address_book_entry) {
- entry.pushKV("label", pwallet->m_address_book.at(s.destination).name);
+ entry.pushKV("label", address_book_entry->name);
}
entry.pushKV("vout", s.vout);
entry.pushKV("fee", ValueFromAmount(-nFee));
@@ -1335,7 +1335,7 @@ static void ListTransactions(interfaces::Chain::Lock& locked_chain, const CWalle
std::string label;
const auto* address_book_entry = pwallet->FindAddressBookEntry(r.destination);
if (address_book_entry) {
- label = pwallet->m_address_book.at(r.destination).name;
+ label = address_book_entry->name;
}
if (filter_label && label != *filter_label) {
continue;
@@ -3820,7 +3820,7 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
// value of the name key/value pair in the labels array below.
const auto* address_book_entry = pwallet->FindAddressBookEntry(dest);
if (pwallet->chain().rpcEnableDeprecated("label") && address_book_entry) {
- ret.pushKV("label", pwallet->m_address_book.at(dest).name);
+ ret.pushKV("label", address_book_entry->name);
}
ret.pushKV("ischange", pwallet->IsChange(scriptPubKey));