consensus/misc: hardening header verification

This commit is contained in:
Sina Mahmoodi 2026-02-17 14:44:46 +01:00
parent 0cba803fba
commit 698213592a

View file

@ -43,6 +43,10 @@ func VerifyEIP1559Header(config *params.ChainConfig, parent, header *types.Heade
if header.BaseFee == nil {
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.
expectedBaseFee := CalcBaseFee(config, parent)
if header.BaseFee.Cmp(expectedBaseFee) != 0 {