mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
miner: move blob gas checks
This commit is contained in:
parent
d47bcafb30
commit
dde6292b44
2 changed files with 12 additions and 12 deletions
|
|
@ -365,6 +365,17 @@ func (miner *Miner) commitTransactions(env *environment, plainTxs, blobTxs *tran
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Most of the blob gas logic here is agnostic as to if the chain supports
|
||||||
|
// blobs or not, however the max check panics when called on a chain without
|
||||||
|
// a defined schedule, so we need to verify it's safe to call.
|
||||||
|
if miner.chainConfig.IsCancun(env.header.Number, env.header.Time) {
|
||||||
|
if left := miner.chainConfig.MaxBlobsPerBlock(env.header.Time) - uint64(env.blobs); left < (ltx.BlobGas / params.BlobTxBlobGasPerBlob) {
|
||||||
|
log.Trace("Not enough blob space left for transaction", "hash", ltx.Hash, "left", left, "needed", ltx.BlobGas/params.BlobTxBlobGasPerBlob)
|
||||||
|
txs.Pop()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Transaction seems to fit, pull it up from the pool
|
// Transaction seems to fit, pull it up from the pool
|
||||||
tx := ltx.Resolve()
|
tx := ltx.Resolve()
|
||||||
if tx == nil {
|
if tx == nil {
|
||||||
|
|
@ -373,17 +384,6 @@ func (miner *Miner) commitTransactions(env *environment, plainTxs, blobTxs *tran
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Most of the blob gas logic here is agnostic as to if the chain supports
|
|
||||||
// blobs or not, however the max check panics when called on a chain without
|
|
||||||
// a defined schedule, so we need to verify it's safe to call.
|
|
||||||
if miner.chainConfig.IsCancun(env.header.Number, env.header.Time) {
|
|
||||||
if left := miner.chainConfig.MaxBlobsPerBlock(env.header.Time) - uint64(env.blobs); left < (ltx.BlobGas / params.BlobTxBlobGasPerBlob) {
|
|
||||||
log.Trace("Not enough blob space left for transaction", "hash", tx.Hash(), "left", left, "needed", ltx.BlobGas/params.BlobTxBlobGasPerBlob)
|
|
||||||
txs.Pop()
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error may be ignored here. The error has already been checked
|
// Error may be ignored here. The error has already been checked
|
||||||
// during transaction acceptance in the transaction pool.
|
// during transaction acceptance in the transaction pool.
|
||||||
from, _ := types.Sender(env.signer, tx)
|
from, _ := types.Sender(env.signer, tx)
|
||||||
|
|
|
||||||
|
|
@ -301,7 +301,7 @@ var (
|
||||||
Max: 6,
|
Max: 6,
|
||||||
UpdateFraction: 3338477,
|
UpdateFraction: 3338477,
|
||||||
}
|
}
|
||||||
// DefaultPragueBlobConfig is the default blob configuration for the Cancun fork.
|
// DefaultPragueBlobConfig is the default blob configuration for the Prague fork.
|
||||||
DefaultPragueBlobConfig = &BlobConfig{
|
DefaultPragueBlobConfig = &BlobConfig{
|
||||||
Target: 6,
|
Target: 6,
|
||||||
Max: 9,
|
Max: 9,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue