Skip to content

Commit

Permalink
exit building loop early if there's no more room for min-sized transa…
Browse files Browse the repository at this point in the history
…ction in the block (#439)
  • Loading branch information
roberto-bayardo authored Dec 2, 2024
1 parent b84907b commit 0a46245
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,12 @@ func (miner *Miner) commitTransactions(env *environment, plainTxs, blobTxs *tran
log.Debug("adding tx would exceed block DA size limit",
"hash", ltx.Hash, "txda", ltx.DABytes, "blockda", blockDABytes, "dalimit", miner.config.MaxDABlockSize)
txs.Pop()
// If the number of remaining bytes is too few to hold even the minimum possible transaction size,
// then we can stop early.
daBytesRemaining := new(big.Int).Sub(miner.config.MaxDABlockSize, daBytesAfter)
if daBytesRemaining.Cmp(types.MinTransactionSize) < 0 {
break
}
continue
}
}
Expand Down

0 comments on commit 0a46245

Please sign in to comment.