mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core/txpool: do less big.Int constructions with the min blob cap
This commit is contained in:
parent
63242de55c
commit
d98bff734b
2 changed files with 9 additions and 4 deletions
|
|
@ -402,7 +402,7 @@ func (p *BlobPool) Init(gasTip uint64, head *types.Header, reserve txpool.Addres
|
||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
basefee = uint256.MustFromBig(eip1559.CalcBaseFee(p.chain.Config(), p.head))
|
basefee = uint256.MustFromBig(eip1559.CalcBaseFee(p.chain.Config(), p.head))
|
||||||
blobfee = uint256.MustFromBig(big.NewInt(params.BlobTxMinBlobGasprice))
|
blobfee = uint256.NewInt(params.BlobTxMinBlobGasprice)
|
||||||
)
|
)
|
||||||
if p.head.ExcessBlobGas != nil {
|
if p.head.ExcessBlobGas != nil {
|
||||||
blobfee = uint256.MustFromBig(eip4844.CalcBlobFee(*p.head.ExcessBlobGas))
|
blobfee = uint256.MustFromBig(eip4844.CalcBlobFee(*p.head.ExcessBlobGas))
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,12 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// blobTxMinBlobGasPrice is the big.Int version of the configured protocol
|
||||||
|
// parameter to avoid constucting a new big integer for every transaction.
|
||||||
|
blobTxMinBlobGasPrice = big.NewInt(params.BlobTxMinBlobGasprice)
|
||||||
|
)
|
||||||
|
|
||||||
// ValidationOptions define certain differences between transaction validation
|
// ValidationOptions define certain differences between transaction validation
|
||||||
// across the different pools without having to duplicate those checks.
|
// across the different pools without having to duplicate those checks.
|
||||||
type ValidationOptions struct {
|
type ValidationOptions struct {
|
||||||
|
|
@ -109,9 +115,8 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
|
||||||
}
|
}
|
||||||
if tx.Type() == types.BlobTxType {
|
if tx.Type() == types.BlobTxType {
|
||||||
// Ensure the blob fee cap satisfies the minimum blob gas price
|
// Ensure the blob fee cap satisfies the minimum blob gas price
|
||||||
minBlobGasPrice := big.NewInt(params.BlobTxMinBlobGasprice)
|
if tx.BlobGasFeeCapIntCmp(blobTxMinBlobGasPrice) < 0 {
|
||||||
if tx.BlobGasFeeCapIntCmp(minBlobGasPrice) < 0 {
|
return fmt.Errorf("%w: blob fee cap %v, minimum needed %v", ErrUnderpriced, tx.BlobGasFeeCap(), blobTxMinBlobGasPrice)
|
||||||
return fmt.Errorf("%w: blob fee cap %v, minimum needed %v", ErrUnderpriced, tx.BlobGasFeeCap(), minBlobGasPrice)
|
|
||||||
}
|
}
|
||||||
sidecar := tx.BlobTxSidecar()
|
sidecar := tx.BlobTxSidecar()
|
||||||
if sidecar == nil {
|
if sidecar == nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue