go-ethereum/eth/downloader
CPerezz a15c05a406
eth/downloader: fix second sync target selection for partial state
The second state sync (pivot→HEAD) determines its target using
CurrentSnapBlock(), which may equal CurrentBlock() if no afterP blocks
were processed before the queue drained. This is a timing-dependent
race: with rate-limited pivot advances, the pivot ends up close to
the CL head, so the final batch may contain zero afterP blocks,
causing CurrentSnapBlock == CurrentBlock. The check
`snapHead.Hash() != currentHead.Hash()` then fails and the second
sync is skipped entirely. Without the second sync, disableSnap()
is never called, ConfigSyncMode() stays SnapSync, and ALL subsequent
newPayload calls are delayed forever.

Fix: use the skeleton head (beacon chain tip) as the second sync
target instead of CurrentSnapBlock(). The skeleton head is always
available and correctly reflects the CL's latest finalized target,
independent of queue draining timing.

Also removes the fragile "snap head too old" and "snap head too far
behind" guards which could abort the second sync prematurely.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-17 12:13:05 +02:00
..
api.go eth/downloader: fix incomplete code comment (#32354) 2025-08-07 16:31:02 +02:00
beacondevsync.go eth/downloader: keep current syncmode in downloader only (#33157) 2025-12-08 22:49:57 +01:00
beaconsync.go core, eth: fix end-to-end partial state sync pipeline 2026-04-17 12:05:26 +02:00
downloader.go eth/downloader: fix second sync target selection for partial state 2026-04-17 12:13:05 +02:00
downloader_test.go eth: add chain retention, BAL engine API support, and bug fixes 2026-04-17 11:55:16 +02:00
events.go cmd,eth: 16400 Add an option to stop geth once in sync. WIP for light mode (#17321) 2019-01-30 08:40:36 +01:00
fetchers.go cmd, eth, internal: introduce debug_sync (#32177) 2025-07-28 14:57:45 +08:00
fetchers_concurrent.go eth/downloader: purge pre-merge sync code (#29281) 2024-04-30 15:46:53 +02:00
fetchers_concurrent_bodies.go eth/protocols/eth, eth/protocols/snap: delayed p2p message decoding (#33835) 2026-02-15 21:21:16 +08:00
fetchers_concurrent_receipts.go eth: implement EIP-7975 (eth/70 - partial block receipt lists) (#33153) 2026-03-30 15:17:37 +02:00
metrics.go core, eth/downloader: implement pruning mode sync (#31414) 2025-04-03 15:16:35 +02:00
peer.go eth: implement EIP-7975 (eth/70 - partial block receipt lists) (#33153) 2026-03-30 15:17:37 +02:00
queue.go eth/protocols/eth, eth/protocols/snap: delayed p2p message decoding (#33835) 2026-02-15 21:21:16 +08:00
queue_test.go eth/protocols/eth, eth/protocols/snap: delayed p2p message decoding (#33835) 2026-02-15 21:21:16 +08:00
resultstore.go core, eth/downloader: implement pruning mode sync (#31414) 2025-04-03 15:16:35 +02:00
skeleton.go eth/downloader: fix stale beacon header deletion (#33481) 2025-12-29 16:13:30 +08:00
skeleton_test.go eth: implement EIP-7975 (eth/70 - partial block receipt lists) (#33153) 2026-03-30 15:17:37 +02:00
statesync.go eth: request id dispatcher and direct req/reply APIs (#23576) 2021-11-26 13:26:03 +02:00
syncmode.go core, eth: add lock protection in snap sync (#33428) 2025-12-19 09:36:48 +01:00
testchain_test.go core: consolidate BlockChain constructor options (#31925) 2025-06-19 12:21:15 +02:00