From 4402a89c426ad43c8e75d92ac3c823deab6e8ce8 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 8 Jul 2025 07:10:26 +0200 Subject: [PATCH] miner: check tx fits block size unconditionally --- miner/worker.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/miner/worker.go b/miner/worker.go index 0bd890b5d2..421ea84651 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -64,6 +64,11 @@ type environment struct { witness *stateless.Witness } +// txFits reports whether the transaction fits into the block size limit. +func (env *environment) txFitsSize(tx *types.Transaction) bool { + return env.size+tx.Size() < params.BlockRLPSizeCap-blockRLPSizeCapBuffer +} + const ( commitInterruptNone int32 = iota commitInterruptNewHead @@ -417,7 +422,7 @@ func (miner *Miner) commitTransactions(env *environment, plainTxs, blobTxs *tran // if inclusion of the transaction would put the block size over the // maximum we allow, don't add any more txs to the payload. - if isOsaka && env.size+tx.Size() > params.BlockRLPSizeCap-blockRLPSizeCapBuffer { + if !env.txFitsSize(tx) { break }