miner: check tx fits block size unconditionally

This commit is contained in:
Felix Lange 2025-07-08 07:10:26 +02:00
parent 84609d8855
commit 4402a89c42

View file

@ -64,6 +64,11 @@ type environment struct {
witness *stateless.Witness 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 ( const (
commitInterruptNone int32 = iota commitInterruptNone int32 = iota
commitInterruptNewHead 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 // if inclusion of the transaction would put the block size over the
// maximum we allow, don't add any more txs to the payload. // 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 break
} }