Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Only apply effective gas limit when building new blocks #394

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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