mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 07:37:20 +00:00
consensus/misc: hardening header verification (#33860)
Defensively check parent's base fee before using it for calculations.
This commit is contained in:
parent
a4b3898f90
commit
550ca91b17
1 changed files with 4 additions and 0 deletions
|
|
@ -43,6 +43,10 @@ func VerifyEIP1559Header(config *params.ChainConfig, parent, header *types.Heade
|
||||||
if header.BaseFee == nil {
|
if header.BaseFee == nil {
|
||||||
return errors.New("header is missing baseFee")
|
return errors.New("header is missing baseFee")
|
||||||
}
|
}
|
||||||
|
// Verify the parent header is not malformed
|
||||||
|
if config.IsLondon(parent.Number) && parent.BaseFee == nil {
|
||||||
|
return errors.New("parent header is missing baseFee")
|
||||||
|
}
|
||||||
// Verify the baseFee is correct based on the parent header.
|
// Verify the baseFee is correct based on the parent header.
|
||||||
expectedBaseFee := CalcBaseFee(config, parent)
|
expectedBaseFee := CalcBaseFee(config, parent)
|
||||||
if header.BaseFee.Cmp(expectedBaseFee) != 0 {
|
if header.BaseFee.Cmp(expectedBaseFee) != 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue