Skip to content

eth/protocols/snap: purge stale sync state when snap sync v2 is re-enabled#35316

Open
jrhea wants to merge 3 commits into
ethereum:masterfrom
jrhea:snap2-reenable-precleanup
Open

eth/protocols/snap: purge stale sync state when snap sync v2 is re-enabled#35316
jrhea wants to merge 3 commits into
ethereum:masterfrom
jrhea:snap2-reenable-precleanup

Conversation

@jrhea

@jrhea jrhea commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

If snap sync v2 is re-enabled after a previous sync already completed and committed its pivot, the leftover journal is now discarded instead of resumed.

@jrhea jrhea requested a review from rjl493456442 as a code owner July 7, 2026 19:03
@jrhea jrhea changed the title eth/protocols/snap: purge stale sync state when snap sync is re-enabled eth/protocols/snap: purge stale sync state when snap sync v2 is re-enabled Jul 7, 2026
@jrhea jrhea added the snap/2 label Jul 7, 2026
@rjl493456442

Copy link
Copy Markdown
Member

I am curious in which case the snap sync will be re-enabled on top of a synced node. As the defensive mechanism, I am fine with it.

// isPivotCommitted reports whether the head block has caught up to the
// pivot. That only happens when a completed sync committed the pivot block
// as the new chain head.
func isPivotCommitted(db ethdb.Database, pivot *types.Header) bool {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we consider the Pivot block is canonical or not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants