Skip to content

Commit

Permalink
core: improve ambiguous block validation message (ethereum#26582)
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman authored and shekhirin committed Jun 6, 2023
1 parent d6ca922 commit c1623f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c1623f6

Please sign in to comment.