From fd59c9caf10da4b48d0f5ff05551090e9dc02da3 Mon Sep 17 00:00:00 2001 From: rjl493456442 Date: Mon, 11 May 2020 18:29:13 +0800 Subject: [PATCH] core: address comment --- core/blockchain.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/blockchain.go b/core/blockchain.go index 39dba83a24..2a331cb594 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1680,7 +1680,12 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, er // as the canonical chain eventually, it needs to be reexecuted for missing // state, but if it's this special case here(skip reexecution) we will lose // the empty receipt entry. - rawdb.WriteReceipts(bc.db, block.Hash(), block.NumberU64(), nil) + if len(block.Transactions()) == 0 { + rawdb.WriteReceipts(bc.db, block.Hash(), block.NumberU64(), nil) + } else { + log.Error("Please file an issue, skip known block execution without receipt", + "hash", block.Hash(), "number", block.NumberU64()) + } if err := bc.writeKnownBlock(block); err != nil { return it.index, err }