Skip to content

Commit a102b8e

Browse files
committed
Merge branch 'main' into alex/2803_best_2worlds
* main: fix(node): race on caught up (#3133)
2 parents dd7e0cd + c0bc141 commit a102b8e

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

block/internal/syncing/syncer.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,11 @@ func (s *Syncer) HasReachedDAHead() bool {
396396

397397
// fetchDAUntilCaughtUp was removed — the DAFollower handles this concern.
398398

399+
// PendingCount returns the number of unprocessed height events in the pipeline.
400+
func (s *Syncer) PendingCount() int {
401+
return len(s.heightInCh)
402+
}
403+
399404
func (s *Syncer) pendingWorkerLoop(ctx context.Context) {
400405
defer s.wg.Done()
401406

node/failover.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@ func (f *failoverState) waitForCatchup(ctx context.Context) (bool, error) {
315315
p2pCaughtUp = true
316316
}
317317

318-
if daCaughtUp && p2pCaughtUp {
318+
pipelineDrained := f.bc.Syncer == nil || f.bc.Syncer.PendingCount() == 0
319+
if daCaughtUp && p2pCaughtUp && pipelineDrained {
319320
f.logger.Info().
320321
Uint64("store_height", storeHeight).
321322
Uint64("max_p2p_height", maxP2PHeight).

0 commit comments

Comments
 (0)