Skip to content

Commit

Permalink
Fix conflict in state_advance_timer
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhauner committed Jun 28, 2022
1 parent 0d8a9d8 commit b5388ae
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions beacon_node/beacon_chain/src/state_advance_timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,14 @@ async fn state_advance_timer<T: BeaconChainTypes>(
let log = log.clone();
let beacon_chain = beacon_chain.clone();
let next_slot = current_slot + 1;
executor.spawn_blocking(
move || {
executor.spawn(
async move {
// Don't run fork choice during sync.
if beacon_chain.best_slot().map_or(true, |head_slot| {
head_slot + MAX_FORK_CHOICE_DISTANCE < current_slot
}) {
if beacon_chain.best_slot() + MAX_FORK_CHOICE_DISTANCE < current_slot {
return;
}

if let Err(e) = beacon_chain.fork_choice_at_slot(next_slot) {
if let Err(e) = beacon_chain.recompute_head_at_slot(next_slot).await {
warn!(
log,
"Error updating fork choice for next slot";
Expand Down Expand Up @@ -264,7 +262,7 @@ fn advance_head<T: BeaconChainTypes>(
//
// Fork-choice is not run *before* this function to avoid unnecessary calls whilst syncing.
{
let head_slot = beacon_chain.head_info()?.slot;
let head_slot = beacon_chain.best_slot();

// Don't run this when syncing or if lagging too far behind.
if head_slot + MAX_ADVANCE_DISTANCE < current_slot {
Expand All @@ -275,7 +273,7 @@ fn advance_head<T: BeaconChainTypes>(
}
}

let head_root = beacon_chain.head_info()?.block_root;
let head_root = beacon_chain.head_beacon_block_root();

let (head_slot, head_state_root, mut state) = match beacon_chain
.snapshot_cache
Expand Down

0 comments on commit b5388ae

Please sign in to comment.