Skip to content

Commit

Permalink
smallish speedup -- also use cache in get_crosslink_deltas
Browse files Browse the repository at this point in the history
  • Loading branch information
tersec authored and zah committed Mar 28, 2019
1 parent 6f481f8 commit 58b6174
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions beacon_chain/state_transition.nim
Expand Up @@ -961,8 +961,12 @@ func get_crosslink_deltas(
for cas in get_crosslink_committees_at_slot_cached(state, slot, false, crosslink_committees_cache):
let
(crosslink_committee, shard) = cas
(winning_root, participants) = get_winning_root_and_participants(
state, shard, crosslink_committees_cache)
(winning_root, participants) =
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)
participating_balance = get_total_balance(state, participants)
total_balance = get_total_balance(state, crosslink_committee)
Expand Down

0 comments on commit 58b6174

Please sign in to comment.