core: return error if repair block failed (#18126)

* core: return error if repair block failed

* make error a bit shorter
This commit is contained in:
mr_franklin 2018-11-23 17:16:14 +08:00 committed by Péter Szilágyi
parent b24ef5e05d
commit 2a113f6d72

@ -445,7 +445,11 @@ func (bc *BlockChain) repair(head **types.Block) error {
return nil return nil
} }
// Otherwise rewind one block and recheck state availability there // 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("missing block %d [%x]", (*head).NumberU64()-1, (*head).ParentHash())
}
(*head) = block
} }
} }