mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-12 15:03:45 +00:00
fix: Update baseFee verification logic (#211)
* update baseFee verification logic * only apply workaround for clique
This commit is contained in:
parent
3a080e5cb4
commit
5caecc87cf
1 changed files with 10 additions and 1 deletions
|
|
@ -43,7 +43,16 @@ func VerifyEip1559Header(config *params.ChainConfig, parent, header *types.Heade
|
||||||
return fmt.Errorf("header is missing baseFee")
|
return fmt.Errorf("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)
|
|
||||||
|
var expectedBaseFee *big.Int
|
||||||
|
|
||||||
|
// compatible check with the logic in commitNewWork
|
||||||
|
if config.Clique == nil || (config.EnableEIP2718 && config.EnableEIP1559) {
|
||||||
|
expectedBaseFee = CalcBaseFee(config, parent)
|
||||||
|
} else {
|
||||||
|
expectedBaseFee = big.NewInt(0)
|
||||||
|
}
|
||||||
|
|
||||||
if header.BaseFee.Cmp(expectedBaseFee) != 0 {
|
if header.BaseFee.Cmp(expectedBaseFee) != 0 {
|
||||||
return fmt.Errorf("invalid baseFee: have %s, want %s, parentBaseFee %s, parentGasUsed %d",
|
return fmt.Errorf("invalid baseFee: have %s, want %s, parentBaseFee %s, parentGasUsed %d",
|
||||||
expectedBaseFee, header.BaseFee, parent.BaseFee, parent.GasUsed)
|
expectedBaseFee, header.BaseFee, parent.BaseFee, parent.GasUsed)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue