From a73aad6c034589bbb100e27f9af0d7312f4c99cd Mon Sep 17 00:00:00 2001 From: j75689 Date: Wed, 20 Apr 2022 18:00:32 +0800 Subject: [PATCH] fix validateBody --- core/block_validator.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/block_validator.go b/core/block_validator.go index 2afe81ce0b..6f2c40b2ec 100644 --- a/core/block_validator.go +++ b/core/block_validator.go @@ -79,6 +79,12 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error { } validateFuns := []func() error{ + func() error { + if v.bc.HasBlockAndState(block.Hash(), block.NumberU64()) { + return ErrKnownBlock + } + return nil + }, func() error { if hash := types.DeriveSha(block.Transactions(), trie.NewStackTrie(nil)); hash != header.TxHash { return fmt.Errorf("transaction root hash mismatch: have %x, want %x", hash, header.TxHash)