Skip to content

cmd/utils: return ErrImportInterrupted sentinel from batch-import interrupt#35153

Open
cuiweixie wants to merge 1 commit into
ethereum:masterfrom
cuiweixie:fix-importchain-interrupt-sentinel
Open

cmd/utils: return ErrImportInterrupted sentinel from batch-import interrupt#35153
cuiweixie wants to merge 1 commit into
ethereum:masterfrom
cuiweixie:fix-importchain-interrupt-sentinel

Conversation

@cuiweixie

Copy link
Copy Markdown
Contributor

ImportChain has two interrupt checkpoints. The one before loading a batch correctly returns the exported ErrImportInterrupted sentinel, but the one before inserting a batch returned a freshly constructed errors.New("interrupted") instead.

The caller in cmd/geth/chaincmd.go detects interruption with err == utils.ErrImportInterrupted to stop processing the remaining files in a multi-file import. A fresh error value never compares equal to the sentinel, so an interrupt caught at this checkpoint was treated as an ordinary per-file failure and the loop kept importing subsequent files.

Return the ErrImportInterrupted sentinel here too so both checkpoints are recognized by the caller.

…errupt

ImportChain has two interrupt checkpoints. The one before loading a batch
correctly returns the exported ErrImportInterrupted sentinel, but the one
before inserting a batch returned a freshly constructed
errors.New("interrupted") instead.

The caller in cmd/geth/chaincmd.go detects interruption with
`err == utils.ErrImportInterrupted` to stop processing the remaining
files in a multi-file import. A fresh error value never compares equal to
the sentinel, so an interrupt caught at this checkpoint was treated as an
ordinary per-file failure and the loop kept importing subsequent files.

Return the ErrImportInterrupted sentinel here too so both checkpoints are
recognized by the caller.
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.

1 participant