implements copy-on-write for staked-nodes (backport #19090) (#22507)

* implements copy-on-write for staked-nodes (#19090)

Bank::staked_nodes and Bank::epoch_staked_nodes redundantly clone
staked-nodes HashMap even though an immutable reference will suffice:
https://github.com/solana-labs/solana/blob/a9014cece/runtime/src/vote_account.rs#L77

This commit implements copy-on-write semantics for staked-nodes by
wrapping the underlying HashMap in Arc<...>.

(cherry picked from commit f302774cf7)

# Conflicts:
#	runtime/src/bank.rs
#	runtime/src/stakes.rs
#	runtime/src/vote_account.rs

* removes backport merge conflicts

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
This commit is contained in:
mergify[bot]
2022-01-14 15:26:11 +00:00
committed by GitHub
parent debac00724
commit 40ef11ec86
9 changed files with 51 additions and 39 deletions

View File

@@ -1430,9 +1430,9 @@ dependencies = [
[[package]]
name = "itertools"
version = "0.10.0"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319"
checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3"
dependencies = [
"either",
]
@@ -2764,7 +2764,7 @@ dependencies = [
"bincode",
"byteorder 1.3.4",
"elf",
"itertools 0.10.0",
"itertools 0.10.3",
"log",
"miow 0.2.2",
"net2",
@@ -3501,7 +3501,7 @@ dependencies = [
"dir-diff",
"flate2",
"fnv",
"itertools 0.9.0",
"itertools 0.10.3",
"lazy_static",
"libc",
"libloading",