mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
consensus: check gas limit bounds in header, close XFN-07 (#1616)
This commit is contained in:
parent
8c101cd961
commit
0aa7ccb81e
2 changed files with 9 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/XinFinOrg/XDPoSChain/common/hexutil"
|
||||
"github.com/XinFinOrg/XDPoSChain/consensus"
|
||||
"github.com/XinFinOrg/XDPoSChain/consensus/XDPoS/utils"
|
||||
"github.com/XinFinOrg/XDPoSChain/consensus/misc"
|
||||
"github.com/XinFinOrg/XDPoSChain/consensus/misc/eip1559"
|
||||
"github.com/XinFinOrg/XDPoSChain/core/types"
|
||||
"github.com/XinFinOrg/XDPoSChain/log"
|
||||
|
|
@ -95,6 +96,10 @@ func (x *XDPoS_v2) verifyHeader(chain consensus.ChainReader, header *types.Heade
|
|||
if header.UncleHash != utils.UncleHash {
|
||||
return utils.ErrInvalidUncleHash
|
||||
}
|
||||
// Verify that the gas limit remains within allowed bounds
|
||||
if err := misc.VerifyGaslimit(parent.GasLimit, header.GasLimit); err != nil {
|
||||
return err
|
||||
}
|
||||
// Verify the header's EIP-1559 attributes.
|
||||
if err := eip1559.VerifyEip1559Header(chain.Config(), header); err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -198,6 +198,10 @@ func (ethash *Ethash) verifyHeader(chain consensus.ChainReader, header, parent *
|
|||
if header.GasUsed > header.GasLimit {
|
||||
return fmt.Errorf("invalid gasUsed: have %d, gasLimit %d", header.GasUsed, header.GasLimit)
|
||||
}
|
||||
// Verify that the gas limit remains within allowed bounds
|
||||
if err := misc.VerifyGaslimit(parent.GasLimit, header.GasLimit); err != nil {
|
||||
return err
|
||||
}
|
||||
// Verify the header's EIP-1559 attributes.
|
||||
if err := eip1559.VerifyEip1559Header(chain.Config(), header); err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Reference in a new issue