Skip to content

Commit

Permalink
core: return error if repair block failed (#18126)
Browse files Browse the repository at this point in the history
* core: return error if repair block failed

* make error a bit shorter
  • Loading branch information
mrFranklin authored and karalabe committed Nov 23, 2018
1 parent b24ef5e commit 2a113f6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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("missing block %d [%x]", (*head).NumberU64()-1, (*head).ParentHash())
}
(*head) = block
}
}

Expand Down

0 comments on commit 2a113f6

Please sign in to comment.