smallish speedup -- also use cache in get_crosslink_deltas

This commit is contained in:
Dustin Brody 2019-03-27 18:39:00 -07:00 committed by zah
parent 6f481f8812
commit 58b6174654
1 changed files with 6 additions and 2 deletions

View File

@ -961,8 +961,12 @@ func get_crosslink_deltas(
for cas in get_crosslink_committees_at_slot_cached(state, slot, false, crosslink_committees_cache): for cas in get_crosslink_committees_at_slot_cached(state, slot, false, crosslink_committees_cache):
let let
(crosslink_committee, shard) = cas (crosslink_committee, shard) = cas
(winning_root, participants) = get_winning_root_and_participants( (winning_root, participants) =
state, shard, crosslink_committees_cache) if shard notin winning_root_participants_cache:
get_winning_root_and_participants(
state, shard, crosslink_committees_cache)
else:
(ZERO_HASH, winning_root_participants_cache[shard])
nonquadraticParticipants = toSet(participants) nonquadraticParticipants = toSet(participants)
participating_balance = get_total_balance(state, participants) participating_balance = get_total_balance(state, participants)
total_balance = get_total_balance(state, crosslink_committee) total_balance = get_total_balance(state, crosslink_committee)