Skip to content

eth/protocols/snap: don't ignore batch write error in resetSyncState - #35521

Open
0xSHKWON wants to merge 2 commits into
ethereum:masterfrom
0xSHKWON:snap-reset-sync-state-write-error
Open

eth/protocols/snap: don't ignore batch write error in resetSyncState#35521
0xSHKWON wants to merge 2 commits into
ethereum:masterfrom
0xSHKWON:snap-reset-sync-state-write-error

Conversation

@0xSHKWON

Copy link
Copy Markdown
Contributor

The final batch.Write in resetSyncState is the only unchecked batch write in this file; if it fails, the in-memory state is reinitialized as a fresh sync while the stale flat state remains on disk, silently corrupting the regenerated state.

@0xSHKWON
0xSHKWON requested a review from rjl493456442 as a code owner August 12, 2026 06:28
deleteRange(batch, rawdb.SnapshotStoragePrefix)
s.resetTrienodes(batch)
batch.Write()
if err := batch.Write(); err != nil {

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.

Please return the error instead of panicing here.

@0xSHKWON 0xSHKWON Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done!

@0xSHKWON
0xSHKWON force-pushed the snap-reset-sync-state-write-error branch from 29ce01e to e6cee39 Compare August 24, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants