mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 22:26:42 +00:00
make sure that we respect the buffer when adding transactions. comments and constant deduplication.
This commit is contained in:
parent
799a5b1c76
commit
199faa7678
1 changed files with 9 additions and 5 deletions
|
|
@ -69,6 +69,11 @@ const (
|
||||||
commitInterruptNewHead
|
commitInterruptNewHead
|
||||||
commitInterruptResubmit
|
commitInterruptResubmit
|
||||||
commitInterruptTimeout
|
commitInterruptTimeout
|
||||||
|
|
||||||
|
// cap the size of blocks we will produce below the max allowed by
|
||||||
|
// EIP-7934. This gives us buffer room if the estimated size of the
|
||||||
|
// block we are building is off from the actual encoded size.
|
||||||
|
blockRLPSizeCapBuffer = 1_000_000
|
||||||
)
|
)
|
||||||
|
|
||||||
// newPayloadResult is the result of payload generation.
|
// newPayloadResult is the result of payload generation.
|
||||||
|
|
@ -118,10 +123,7 @@ func (miner *Miner) generateWork(genParam *generateParams, witness bool) *newPay
|
||||||
|
|
||||||
var includedWithdrawals types.Withdrawals
|
var includedWithdrawals types.Withdrawals
|
||||||
if miner.chainConfig.IsOsaka(work.header.Number, work.header.Time) {
|
if miner.chainConfig.IsOsaka(work.header.Number, work.header.Time) {
|
||||||
// cap the size of blocks we will produce below the cap allowed by
|
maxBlockSize := params.BlockRLPSizeCap - blockRLPSizeCapBuffer
|
||||||
// EIP-7934. This gives us buffer room if the estimated size of the
|
|
||||||
// block we are building is somewhat off.
|
|
||||||
maxBlockSize := params.BlockRLPSizeCap - 1_000_000
|
|
||||||
|
|
||||||
for _, withdrawal := range genParam.withdrawals {
|
for _, withdrawal := range genParam.withdrawals {
|
||||||
if int(work.size)+params.WithdrawalSize > maxBlockSize {
|
if int(work.size)+params.WithdrawalSize > maxBlockSize {
|
||||||
|
|
@ -414,7 +416,9 @@ func (miner *Miner) commitTransactions(env *environment, plainTxs, blobTxs *tran
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if miner.chainConfig.IsOsaka(env.header.Number, env.header.Time) && env.size+tx.Size() > params.BlockRLPSizeCap {
|
// 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 miner.chainConfig.IsOsaka(env.header.Number, env.header.Time) && env.size+tx.Size() > params.BlockRLPSizeCap-blockRLPSizeCapBuffer {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue