mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
refactor: Avoid extra lookups of mapAddressBook in listunspent RPC
This commit is contained in:
parent
d76962e056
commit
a59dac35ab
@ -3171,10 +3171,11 @@ UniValue listunspent(const JSONRPCRequest& request)
|
||||
if (fValidAddress) {
|
||||
entry.pushKV("address", EncodeDestination(address));
|
||||
|
||||
if (pwallet->mapAddressBook.count(address)) {
|
||||
entry.pushKV("label", pwallet->mapAddressBook[address].name);
|
||||
auto i = pwallet->mapAddressBook.find(address);
|
||||
if (i != pwallet->mapAddressBook.end()) {
|
||||
entry.pushKV("label", i->second.name);
|
||||
if (IsDeprecatedRPCEnabled("accounts")) {
|
||||
entry.pushKV("account", pwallet->mapAddressBook[address].name);
|
||||
entry.pushKV("account", i->second.name);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user