From 6fa08a065bf467b1c2dca0eb6f9978fa15f6fbac Mon Sep 17 00:00:00 2001 From: Brian Bland Date: Tue, 1 Oct 2024 16:23:49 -0700 Subject: [PATCH 1/2] fix: Only apply effective gas limit when building new blocks --- miner/worker.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/miner/worker.go b/miner/worker.go index 110eb26429..8b20c0531b 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -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 + // force-included 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) } From 5e3de7c11e54778a1254757569004f69e587851e Mon Sep 17 00:00:00 2001 From: Brian Bland Date: Tue, 1 Oct 2024 17:07:39 -0700 Subject: [PATCH 2/2] Update comment --- miner/worker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miner/worker.go b/miner/worker.go index 8b20c0531b..f7f24c9fd2 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -120,7 +120,7 @@ func (miner *Miner) generateWork(params *generateParams) *newPayloadResult { // 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 - // force-included transactions with gas usage up to the block header's limit. + // 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 {