From c008de5439024500afc282e9bdd791b25f8e1a8f Mon Sep 17 00:00:00 2001 From: cuiweixie Date: Thu, 11 Jun 2026 20:00:00 +0800 Subject: [PATCH] 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. --- cmd/utils/cmd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 3cb97ff947..2a20f65ad5 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -221,7 +221,7 @@ func ImportChain(chain *core.BlockChain, fn string) error { } // Import the batch. if checkInterrupt() { - return errors.New("interrupted") + return ErrImportInterrupted } missing := missingBlocks(chain, blocks[:i]) if len(missing) == 0 {