mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 19:30:44 +00:00
cmd/utils: defer close in ImportHistory
This commit is contained in:
parent
2dafd06f23
commit
9755543d30
1 changed files with 1 additions and 2 deletions
|
|
@ -286,8 +286,8 @@ func ImportHistory(chain *core.BlockChain, dir string, network string, from func
|
|||
if err != nil {
|
||||
return fmt.Errorf("open %s: %w", path, err)
|
||||
}
|
||||
defer f.Close()
|
||||
if _, err := io.Copy(h, f); err != nil {
|
||||
f.Close()
|
||||
return fmt.Errorf("checksum %s: %w", path, err)
|
||||
}
|
||||
got := common.BytesToHash(h.Sum(scratch.Bytes()[:])).Hex()
|
||||
|
|
@ -296,7 +296,6 @@ func ImportHistory(chain *core.BlockChain, dir string, network string, from func
|
|||
scratch.Reset()
|
||||
|
||||
if got != want {
|
||||
f.Close()
|
||||
return fmt.Errorf("%s checksum mismatch: have %s want %s", file, got, want)
|
||||
}
|
||||
// Import all block data from Era1.
|
||||
|
|
|
|||
Loading…
Reference in a new issue