From e99330b2bc92223742643284409326c3c41a5005 Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Fri, 10 Apr 2026 10:26:33 +0200 Subject: [PATCH] eth/txtracker: seed lastFinalNum at startup to prevent genesis backfill lastFinalNum started at 0, so the first checkFinalization after startup iterated from block 1 to the current finalized head (~20M blocks on mainnet) under the mutex, stalling the tracker and potentially awarding bogus credit for ancient txs whose hashes happened to match recently-received ones. Seed lastFinalNum from chain.CurrentFinalBlock() in Start() so only blocks finalized after startup are processed. --- eth/txtracker/tracker.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eth/txtracker/tracker.go b/eth/txtracker/tracker.go index 5a18402645..7807c8352a 100644 --- a/eth/txtracker/tracker.go +++ b/eth/txtracker/tracker.go @@ -74,6 +74,10 @@ func New() *Tracker { // Start begins listening for chain head events. func (t *Tracker) Start(chain Chain) { t.chain = chain + // Seed lastFinalNum so checkFinalization doesn't backfill from genesis. + if fh := chain.CurrentFinalBlock(); fh != nil { + t.lastFinalNum = fh.Number.Uint64() + } t.headCh = make(chan core.ChainHeadEvent, 128) t.sub = chain.SubscribeChainHeadEvent(t.headCh) t.wg.Add(1)