@@ -61,6 +61,8 @@ import (
6161 "github.com/ledgerwatch/erigon-lib/types"
6262)
6363
64+ const DefaultBlockGasLimit = uint64 (30000000 )
65+
6466var (
6567 processBatchTxsTimer = metrics .NewSummary (`pool_process_remote_txs` )
6668 addRemoteTxsTimer = metrics .NewSummary (`pool_add_remote_txs` )
@@ -229,7 +231,7 @@ type TxPool struct {
229231}
230232
231233type FeeCalculator interface {
232- CurrentFees (chainConfig * chain.Config , db kv.Getter ) (baseFee uint64 , blobFee uint64 , minBlobGasPrice uint64 , err error )
234+ CurrentFees (chainConfig * chain.Config , db kv.Getter ) (baseFee uint64 , blobFee uint64 , minBlobGasPrice , blockGasLimit uint64 , err error )
233235}
234236
235237func New (newTxs chan types.Announcements , coreDB kv.RoDB , cfg txpoolcfg.Config , cache kvcache.Cache ,
@@ -1317,7 +1319,7 @@ func (p *TxPool) setBaseFee(baseFee uint64) (uint64, bool) {
13171319
13181320func (p * TxPool ) setBlobFee (blobFee uint64 ) {
13191321 if blobFee > 0 {
1320- p .pendingBaseFee .Store (blobFee )
1322+ p .pendingBlobFee .Store (blobFee )
13211323 }
13221324}
13231325
@@ -2086,11 +2088,14 @@ func (p *TxPool) fromDB(ctx context.Context, tx kv.Tx, coreTx kv.Tx) error {
20862088 i ++
20872089 }
20882090
2089- var pendingBaseFee , pendingBlobFee , minBlobGasPrice uint64
2091+ var pendingBaseFee , pendingBlobFee , minBlobGasPrice , blockGasLimit uint64
20902092
20912093 if p .feeCalculator != nil {
20922094 if chainConfig , _ := ChainConfig (tx ); chainConfig != nil {
2093- pendingBaseFee , pendingBlobFee , minBlobGasPrice , _ = p .feeCalculator .CurrentFees (chainConfig , coreTx )
2095+ pendingBaseFee , pendingBlobFee , minBlobGasPrice , blockGasLimit , err = p .feeCalculator .CurrentFees (chainConfig , coreTx )
2096+ if err != nil {
2097+ return err
2098+ }
20942099 }
20952100 }
20962101
@@ -2118,16 +2123,21 @@ func (p *TxPool) fromDB(ctx context.Context, tx kv.Tx, coreTx kv.Tx) error {
21182123 pendingBlobFee = minBlobGasPrice
21192124 }
21202125
2126+ if blockGasLimit == 0 {
2127+ blockGasLimit = DefaultBlockGasLimit
2128+ }
2129+
21212130 err = p .senders .registerNewSenders (& txs , p .logger )
21222131 if err != nil {
21232132 return err
21242133 }
21252134 if _ , _ , err := p .addTxs (p .lastSeenBlock .Load (), cacheView , p .senders , txs ,
2126- pendingBaseFee , pendingBlobFee , math . MaxUint64 /* blockGasLimit */ , false , p .logger ); err != nil {
2135+ pendingBaseFee , pendingBlobFee , blockGasLimit , false , p .logger ); err != nil {
21272136 return err
21282137 }
21292138 p .pendingBaseFee .Store (pendingBaseFee )
21302139 p .pendingBlobFee .Store (pendingBlobFee )
2140+ p .blockGasLimit .Store (blockGasLimit )
21312141 return nil
21322142}
21332143
0 commit comments