don't iterate slot_list if zero-lamport (#16678)
This commit is contained in:
committed by
GitHub
parent
6004c0abf5
commit
123e0bdba7
@ -1570,16 +1570,16 @@ impl AccountsDb {
|
|||||||
self.accounts_index
|
self.accounts_index
|
||||||
.roots_and_ref_count(&locked_entry, max_clean_root),
|
.roots_and_ref_count(&locked_entry, max_clean_root),
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
|
// prune zero_lamport_pubkey set which should contain all 0-lamport
|
||||||
// prune zero_lamport_pubkey set which should contain all 0-lamport
|
// keys whether rooted or not. A 0-lamport update may become rooted
|
||||||
// keys whether rooted or not. A 0-lamport update may become rooted
|
// in the future.
|
||||||
// in the future.
|
let has_zero_lamport_accounts = slot_list
|
||||||
let has_zero_lamport_accounts = slot_list
|
.iter()
|
||||||
.iter()
|
.any(|(_slot, account_info)| account_info.lamports == 0);
|
||||||
.any(|(_slot, account_info)| account_info.lamports == 0);
|
if !has_zero_lamport_accounts {
|
||||||
if !has_zero_lamport_accounts {
|
self.accounts_index.remove_zero_lamport_key(pubkey);
|
||||||
self.accounts_index.remove_zero_lamport_key(pubkey);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release the lock
|
// Release the lock
|
||||||
|
Reference in New Issue
Block a user