From 8b2ad71c29f83566c340740f715cef888cbe8d97 Mon Sep 17 00:00:00 2001 From: Wei-Ning Huang Date: Wed, 28 Nov 2018 17:21:26 +0800 Subject: core: panic if fork found when inserting header chain (#61) --- core/blockchain.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 } -- cgit v1.2.3