implements copy-on-write for vote-accounts (#19362)
Bank::vote_accounts redundantly clones vote-accounts HashMap even though an immutable reference will suffice: https://github.com/solana-labs/solana/blob/95c998a19/runtime/src/bank.rs#L5174-L5186 This commit implements copy-on-write semantics for vote-accounts by wrapping the underlying HashMap in Arc<...>.
This commit is contained in:
@@ -1544,7 +1544,8 @@ fn get_stake_percent_in_gossip(bank: &Bank, cluster_info: &ClusterInfo, log: boo
|
||||
let my_shred_version = cluster_info.my_shred_version();
|
||||
let my_id = cluster_info.id();
|
||||
|
||||
for (_, (activated_stake, vote_account)) in bank.vote_accounts() {
|
||||
for (activated_stake, vote_account) in bank.vote_accounts().values() {
|
||||
let activated_stake = *activated_stake;
|
||||
total_activated_stake += activated_stake;
|
||||
|
||||
if activated_stake == 0 {
|
||||
|
Reference in New Issue
Block a user