From 0ad3aee05cf1386c03f6825ddb020b5ccbb3eb2d Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Wed, 1 Feb 2023 13:02:29 +0100 Subject: [PATCH] core: improve ambiguous block validation message --- core/block_validator.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/block_validator.go b/core/block_validator.go index 813ac0a4384d..7c202292f974 100644 --- a/core/block_validator.go +++ b/core/block_validator.go @@ -60,14 +60,14 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error { return err } if hash := types.CalcUncleHash(block.Uncles()); hash != header.UncleHash { - return fmt.Errorf("uncle root hash mismatch: have %x, want %x", hash, header.UncleHash) + return fmt.Errorf("uncle root hash mismatch (header value %x, calculated %x)", header.UncleHash, hash) } 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) + return fmt.Errorf("transaction root hash mismatch (header value %x, calculated %x)", header.TxHash, hash) } if header.WithdrawalsHash != nil { if hash := types.DeriveSha(block.Withdrawals(), trie.NewStackTrie(nil)); hash != *header.WithdrawalsHash { - return fmt.Errorf("withdrawals root hash mismatch: have %x, want %x", hash, *header.WithdrawalsHash) + return fmt.Errorf("withdrawals root hash mismatch (header value %x, calculated %x)", *header.WithdrawalsHash, hash) } } if !v.bc.HasBlockAndState(block.ParentHash(), block.NumberU64()-1) {