aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorFranklin <mr_franklin@126.com>2018-11-20 22:16:40 +0800
committerFranklin <mr_franklin@126.com>2018-11-20 22:16:40 +0800
commit21dd59bd047d1f291c1a773b690825a3654ea969 (patch)
tree39ac1431427c6cfa0fd5d111462f237066413ba4 /core
parent3d997b6decfaa42e37521ae20bf58886c8b2de8f (diff)
downloadgo-tangerine-21dd59bd047d1f291c1a773b690825a3654ea969.tar
go-tangerine-21dd59bd047d1f291c1a773b690825a3654ea969.tar.gz
go-tangerine-21dd59bd047d1f291c1a773b690825a3654ea969.tar.bz2
go-tangerine-21dd59bd047d1f291c1a773b690825a3654ea969.tar.lz
go-tangerine-21dd59bd047d1f291c1a773b690825a3654ea969.tar.xz
go-tangerine-21dd59bd047d1f291c1a773b690825a3654ea969.tar.zst
go-tangerine-21dd59bd047d1f291c1a773b690825a3654ea969.zip
.
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 d173b2de2..ee1c0702b 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("failed to repair block, can not get block at height %d", (*head).NumberU64())
+ }
+ (*head) = block
}
}