aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authormr_franklin <mr_franklin@126.com>2018-11-23 17:16:14 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-11-23 17:16:14 +0800
commit2a113f6d72d3b612c6686fa2ab8c30f9e7e6e972 (patch)
tree9a887825b19319c4f6fe8127fdccf9cd90744837 /core
parentb24ef5e05d158e1533cf339aea866e0584447cef (diff)
downloadgo-tangerine-2a113f6d72d3b612c6686fa2ab8c30f9e7e6e972.tar
go-tangerine-2a113f6d72d3b612c6686fa2ab8c30f9e7e6e972.tar.gz
go-tangerine-2a113f6d72d3b612c6686fa2ab8c30f9e7e6e972.tar.bz2
go-tangerine-2a113f6d72d3b612c6686fa2ab8c30f9e7e6e972.tar.lz
go-tangerine-2a113f6d72d3b612c6686fa2ab8c30f9e7e6e972.tar.xz
go-tangerine-2a113f6d72d3b612c6686fa2ab8c30f9e7e6e972.tar.zst
go-tangerine-2a113f6d72d3b612c6686fa2ab8c30f9e7e6e972.zip
core: return error if repair block failed (#18126)
* core: return error if repair block failed * make error a bit shorter
Diffstat (limited to 'core')
-rw-r--r--core/blockchain.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/blockchain.go b/core/blockchain.go
index 3a9caf01e..bcd53d498 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -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
}
}