Skip to content

Commit

Permalink
Fix the eth1 tracker poll loop when the blocks are slow (#4221)
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech authored Jun 30, 2022
1 parent a987fa9 commit 4d7852e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/lodestar/src/eth1/eth1DepositDataTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,15 @@ export class Eth1DepositDataTracker {
return true;
} else {
// Blocks are slower than expected, reduce eth1FollowDistance. Limit min CATCHUP_MIN_FOLLOW_DISTANCE
const delta = ETH1_FOLLOW_DISTANCE_DELTA_IF_SLOW;
this.eth1FollowDistance = Math.max(this.eth1FollowDistance - delta, ETH_MIN_FOLLOW_DISTANCE);

return false;
const delta =
this.eth1FollowDistance -
Math.max(this.eth1FollowDistance - ETH1_FOLLOW_DISTANCE_DELTA_IF_SLOW, ETH_MIN_FOLLOW_DISTANCE);
this.eth1FollowDistance = this.eth1FollowDistance - delta;

// Even if the blocks are slow, when we are all caught up as there is no
// further possibility to reduce follow distance, we need to call it quits
// for now, else it leads to an incessant poll on the EL
return delta === 0;
}
}

Expand Down

0 comments on commit 4d7852e

Please sign in to comment.