Skip to content

Commit

Permalink
feat(engine): require at least one FCU before pruning
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Jul 27, 2023
1 parent 4ab924c commit 1265547
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions crates/consensus/beacon/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1710,10 +1710,15 @@ where
// we're pending if both engine messages and sync events are pending (fully drained)
let is_pending = engine_messages_pending && sync_pending;

// check prune events if pipeline is idle AND (pruning is running and we need to
// prioritize checking its events OR no engine and sync messages are pending and we may
// start pruning)
if this.sync.is_pipeline_idle() && (this.is_prune_active() || is_pending) {
// Poll prune controller if all conditions are met:
// 1. Pipeline is idle
// 2. Pruning is running and we need to prioritize checking its events OR no engine and
// sync messages are pending and we may start pruning
// 3. At least one FCU has been processed by the engine
if this.sync.is_pipeline_idle() &&
(this.is_prune_active() || is_pending) &&
!this.forkchoice_state_tracker.is_empty()
{
if let Some(ref mut prune) = this.prune {
match prune.poll(cx, this.blockchain.canonical_tip().number) {
Poll::Ready(prune_event) => {
Expand Down

0 comments on commit 1265547

Please sign in to comment.