Skip to content

Commit

Permalink
Merge pull request #394 from BrianBland/fix-effective-gas-limit-for-n…
Browse files Browse the repository at this point in the history
…on-builders

fix: Only apply effective gas limit when building new blocks
  • Loading branch information
roberto-bayardo authored Oct 2, 2024
2 parents c283254 + 5e3de7c commit 2a8b364
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,16 @@ func (miner *Miner) generateWork(params *generateParams) *newPayloadResult {
return &newPayloadResult{err: err}
}
if work.gasPool == nil {
gasLimit := miner.config.EffectiveGasCeil
if gasLimit == 0 || gasLimit > work.header.GasLimit {
gasLimit = work.header.GasLimit
gasLimit := work.header.GasLimit

// If we're building blocks with mempool transactions, we need to ensure that the
// gas limit is not higher than the effective gas limit. We must still accept any
// explicitly selected transactions with gas usage up to the block header's limit.
if !params.noTxs {
effectiveGasLimit := miner.config.EffectiveGasCeil
if effectiveGasLimit != 0 && effectiveGasLimit < gasLimit {
gasLimit = effectiveGasLimit
}
}
work.gasPool = new(core.GasPool).AddGas(gasLimit)
}
Expand Down

0 comments on commit 2a8b364

Please sign in to comment.