simplify on_tick proposer boost update

This commit is contained in:
Danny Ryan 2021-11-22 11:31:44 -07:00
parent cebe6ba7e7
commit 282d85b9e7
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 4 additions and 3 deletions

View File

@ -369,10 +369,11 @@ def on_tick(store: Store, time: uint64) -> None:
store.time = time store.time = time
current_slot = get_current_slot(store) current_slot = get_current_slot(store)
# Reset store.proposer_score_boost if this is a new slot # Reset store.proposer_score_boost if this is a new slot
if store.proposer_score_boost.root != Root(): if current_slot > previous_slot:
if current_slot != store.blocks[store.proposer_score_boost.root].slot:
store.proposer_score_boost = LatestMessage(root=Root(), epoch=Epoch(0)) store.proposer_score_boost = LatestMessage(root=Root(), epoch=Epoch(0))
# Not a new epoch, return # Not a new epoch, return
if not (current_slot > previous_slot and compute_slots_since_epoch_start(current_slot) == 0): if not (current_slot > previous_slot and compute_slots_since_epoch_start(current_slot) == 0):
return return