mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 14:16:44 +00:00
miner: check tx fits block size unconditionally
This commit is contained in:
parent
84609d8855
commit
4402a89c42
1 changed files with 6 additions and 1 deletions
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue