@@ -18,6 +18,7 @@ package txpool
1818
1919import (
2020 "errors"
21+ "fmt"
2122 "math"
2223 "math/big"
2324 "sort"
@@ -581,14 +582,16 @@ func (pool *TxPool) local() map[common.Address]types.Transactions {
581582// rules, but does not check state-dependent validation such as sufficient balance.
582583// This check is meant as an early check which only needs to be performed once,
583584// and does not require the pool mutex to be held.
584- func (pool * TxPool ) validateTxBasics (tx * types.Transaction , local bool ) error {
585+ func (pool * TxPool ) validateTxBasics (tx * types.Transaction , head * types. Header , local bool ) error {
585586 // Reject transactions over defined size to prevent DOS attacks
586587 if tx .Size () > txMaxSize {
587588 return ErrOversizedData
588589 }
589- //if pool.chainconfig.IsOsaka && tx.Gas() > params.MaxTxGas {
590- // return fmt.Errorf("%w (cap: %d, tx: %d)", core.ErrGasLimitTooHigh, params.MaxTxGas, tx.Gas())
591- //}
590+ rules := pool .chainconfig .Rules (head .Number , true , head .Time )
591+ //if pool.chainconfig.IsOsaka(head.Number, head.Time) && tx.Gas() > params.MaxTxGas {
592+ if rules .IsOsaka && tx .Gas () > params .MaxTxGas {
593+ return fmt .Errorf ("%w (cap: %d, tx: %d)" , core .ErrGasLimitTooHigh , params .MaxTxGas , tx .Gas ())
594+ }
592595 // Transactions can't be negative. This may never happen using RLP decoded
593596 // transactions but may occur if you create a transaction using the RPC.
594597 if tx .Value ().Sign () < 0 {
@@ -961,7 +964,7 @@ func (pool *TxPool) addTxs(txs []*types.Transaction, local, sync bool) []error {
961964 // insufficient intrinsic gas as soon as possible and cache senders
962965 // in transactions before obtaining lock
963966
964- if err := pool .validateTxBasics (tx , local ); err != nil {
967+ if err := pool .validateTxBasics (tx , pool . chain . CurrentBlock (). Header (), local ); err != nil {
965968 errs [i ] = err
966969 invalidTxMeter .Mark (1 )
967970 continue
0 commit comments