mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
core: add validation for Requests
This commit is contained in:
parent
ec69830b6f
commit
bb0f76cf79
1 changed files with 12 additions and 0 deletions
|
|
@ -83,6 +83,18 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {
|
|||
return errors.New("withdrawals present in block body")
|
||||
}
|
||||
|
||||
if header.RequestsHash != nil {
|
||||
if block.Requests() == nil {
|
||||
return errors.New("missing requests in block body")
|
||||
}
|
||||
// todo: update after the #30425 is merged
|
||||
if hash := types.DeriveSha(block.Requests(), trie.NewStackTrie(nil)); hash != *header.RequestsHash {
|
||||
return fmt.Errorf("requests root hash mismatch (header value %x, calculated %x)", *header.RequestsHash, hash)
|
||||
}
|
||||
} else if block.Requests() != nil {
|
||||
return errors.New("requests present in block body")
|
||||
}
|
||||
|
||||
// Blob transactions may be present after the Cancun fork.
|
||||
var blobs int
|
||||
for i, tx := range block.Transactions() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue