From ea0d84aba4e25001615e336da13057f6bd60f10e Mon Sep 17 00:00:00 2001 From: yutianwu Date: Wed, 27 Mar 2024 18:33:43 +0800 Subject: [PATCH] fix test case --- core/block_validator.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/block_validator.go b/core/block_validator.go index 06410bed11..f3d65cea25 100644 --- a/core/block_validator.go +++ b/core/block_validator.go @@ -51,6 +51,11 @@ func NewBlockValidator(config *params.ChainConfig, blockchain *BlockChain, engin // header's transaction and uncle roots. The headers are assumed to be already // validated at this point. func (v *BlockValidator) ValidateBody(block *types.Block) error { + // Check whether the block is already imported. + if v.bc.HasBlockAndState(block.Hash(), block.NumberU64()) { + return ErrKnownBlock + } + // Header validity is known at this point. Here we verify that uncles, transactions // and withdrawals given in the block body match the header. header := block.Header()