Offload remaining confidence cache computation to separate thread (#5792)

* Move remaining confidence cache computation to separate thread

* Move confidence cache out of bank forks
This commit is contained in:
carllin
2019-09-04 23:10:25 -07:00
committed by GitHub
parent f78b865cba
commit bd74e63702
8 changed files with 243 additions and 165 deletions

View File

@@ -304,7 +304,7 @@ impl Tower {
pub fn aggregate_stake_lockouts(
root: Option<u64>,
ancestors: &HashMap<u64, HashSet<u64>>,
stake_lockouts: HashMap<u64, StakeLockout>,
stake_lockouts: &HashMap<u64, StakeLockout>,
) -> HashMap<u64, u128> {
let mut stake_weighted_lockouts: HashMap<u64, u128> = HashMap::new();
for (fork, lockout) in stake_lockouts.iter() {
@@ -562,7 +562,7 @@ mod test {
.into_iter()
.collect();
let stake_weighted_lockouts =
Tower::aggregate_stake_lockouts(tower.root(), &ancestors, stakes);
Tower::aggregate_stake_lockouts(tower.root(), &ancestors, &stakes);
assert!(stake_weighted_lockouts.get(&0).is_none());
assert_eq!(*stake_weighted_lockouts.get(&1).unwrap(), 8 + 16 + 24);
assert_eq!(*stake_weighted_lockouts.get(&2).unwrap(), 8 + 16);