aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-11-28 17:21:26 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:54 +0800
commit8b2ad71c29f83566c340740f715cef888cbe8d97 (patch)
treed5624daa8f54d3458875f96eb7fafe3ae027d99d /core
parentcb16fb0f211ba35220910e68ad3b21e2c3698b72 (diff)
downloaddexon-8b2ad71c29f83566c340740f715cef888cbe8d97.tar
dexon-8b2ad71c29f83566c340740f715cef888cbe8d97.tar.gz
dexon-8b2ad71c29f83566c340740f715cef888cbe8d97.tar.bz2
dexon-8b2ad71c29f83566c340740f715cef888cbe8d97.tar.lz
dexon-8b2ad71c29f83566c340740f715cef888cbe8d97.tar.xz
dexon-8b2ad71c29f83566c340740f715cef888cbe8d97.tar.zst
dexon-8b2ad71c29f83566c340740f715cef888cbe8d97.zip
core: panic if fork found when inserting header chain (#61)
Diffstat (limited to 'core')
-rw-r--r--core/blockchain.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/blockchain.go b/core/blockchain.go
index 2b172b15c..625bf7e3a 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -2238,7 +2238,12 @@ func (bc *BlockChain) InsertDexonHeaderChain(chain []*types.HeaderWithGovState,
whFunc := func(header *types.HeaderWithGovState) error {
bc.mu.Lock()
defer bc.mu.Unlock()
- _, err := bc.hc.WriteDexonHeader(header)
+ status, err := bc.hc.WriteDexonHeader(header)
+ if status == SideStatTy {
+ log.Debug("Inserted forked block header", "number", header.Number, "hash", header.Hash, "diff", header.Difficulty,
+ "gas", header.GasUsed)
+ panic("fork found")
+ }
return err
}