From 214986305ecdc0439cff8771f3235e0ecdb54c8e 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(-) (limited to 'core') diff --git a/core/blockchain.go b/core/blockchain.go index 711457ac1..30552471a 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -2216,7 +2216,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