Skip to content

eth: quick canceling block inserting when debug_setHead is invoked #32067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 23, 2025

Conversation

jsvisa
Copy link
Contributor

@jsvisa jsvisa commented Jun 20, 2025

If Geth is engaged in a long-run block synchronization, such as a full syncing over a large number of blocks, invoking debug_setHead will cause downloader.Cancel to wait for all fetchers to stop first.
This can be time-consuming, particularly for the block processing thread.
To address this, we manually call blockchain.StopInsert to interrupt the blocking processing thread and allow it to exit immediately, and after that call blockchain.ResumeInsert to resume the block downloading process.

Additionally, we add a sanity check for the input block number of debug_setHead to ensure its validity.

@rjl493456442 rjl493456442 self-assigned this Jun 20, 2025
@rjl493456442 rjl493456442 added this to the 1.15.12 milestone Jun 23, 2025
@rjl493456442 rjl493456442 merged commit 78b6059 into ethereum:master Jun 23, 2025
3 of 4 checks passed
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