mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
core: return error if repair block failed
This commit is contained in:
parent
d136e985e8
commit
24519aed01
1 changed files with 5 additions and 1 deletions
|
|
@ -445,7 +445,11 @@ func (bc *BlockChain) repair(head **types.Block) error {
|
|||
return nil
|
||||
}
|
||||
// Otherwise rewind one block and recheck state availability there
|
||||
(*head) = bc.GetBlock((*head).ParentHash(), (*head).NumberU64()-1)
|
||||
block := bc.GetBlock((*head).ParentHash(), (*head).NumberU64()-1)
|
||||
if block == nil {
|
||||
return fmt.Errorf("failed to repair block, can not get block at height %d", (*head).NumberU64())
|
||||
}
|
||||
(*head) = block
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue