mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 13:21:37 +00:00
cmd/utils: return ErrImportInterrupted sentinel from batch-import interrupt
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.
This commit is contained in:
parent
eea6242742
commit
c008de5439
1 changed files with 1 additions and 1 deletions
|
|
@ -221,7 +221,7 @@ func ImportChain(chain *core.BlockChain, fn string) error {
|
||||||
}
|
}
|
||||||
// Import the batch.
|
// Import the batch.
|
||||||
if checkInterrupt() {
|
if checkInterrupt() {
|
||||||
return errors.New("interrupted")
|
return ErrImportInterrupted
|
||||||
}
|
}
|
||||||
missing := missingBlocks(chain, blocks[:i])
|
missing := missingBlocks(chain, blocks[:i])
|
||||||
if len(missing) == 0 {
|
if len(missing) == 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue