From c3e4acc82bd2c548153bff5e6fe0bfa2eb753d15 Mon Sep 17 00:00:00 2001 From: adytzu2007 Date: Sun, 22 Feb 2026 19:29:41 +0200 Subject: [PATCH] fix: reset err inside bad block branch in applyNewBlockBatchOnTip When checkNewBlockHeader returns errKnownBadBlock or errKnowBadParentBlock, the error is sent to event.Processed and the waiting goroutine exits. Without resetting err before returning, the deferred cleanup sees a non-nil err and tries to send to event.Processed a second time with no receiver, blocking the event loop and causing goroutines in backwardDownloadBlockBatches to pile up. Co-Authored-By: Claude Sonnet 4.6 --- polygon/sync/sync.go | 1 + 1 file changed, 1 insertion(+) diff --git a/polygon/sync/sync.go b/polygon/sync/sync.go index c6bfb330201..635482a8029 100644 --- a/polygon/sync/sync.go +++ b/polygon/sync/sync.go @@ -521,6 +521,7 @@ func (s *Sync) applyNewBlockBatchOnTip(ctx context.Context, event EventNewBlockB return ctx.Err() case event.Processed <- err: } + err = nil } return nil }