refactor: Avoid extra lookups of mapAddressBook in listunspent RPC
This commit is contained in:
parent
d76962e056
commit
a59dac35ab
1 changed files with 4 additions and 3 deletions
|
@ -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 a new issue