Unverified Commit a35b654f authored by Marius van der Wijden's avatar Marius van der Wijden Committed by GitHub

core/txpool: check if initcode size is exceeded (#26504)

* core/txpool: check if initcode size is exceeded

* core/txpool: move check
parent 4a3fb585
...@@ -18,6 +18,7 @@ package txpool ...@@ -18,6 +18,7 @@ package txpool
import ( import (
"errors" "errors"
"fmt"
"math" "math"
"math/big" "math/big"
"sort" "sort"
...@@ -599,6 +600,10 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { ...@@ -599,6 +600,10 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
if tx.Size() > txMaxSize { if tx.Size() > txMaxSize {
return ErrOversizedData return ErrOversizedData
} }
// Check whether the init code size has been exceeded.
if pool.shanghai && tx.To() == nil && len(tx.Data()) > params.MaxInitCodeSize {
return fmt.Errorf("%w: code size %v limit %v", core.ErrMaxInitCodeSizeExceeded, len(tx.Data()), params.MaxInitCodeSize)
}
// Transactions can't be negative. This may never happen using RLP decoded // Transactions can't be negative. This may never happen using RLP decoded
// transactions but may occur if you create a transaction using the RPC. // transactions but may occur if you create a transaction using the RPC.
if tx.Value().Sign() < 0 { if tx.Value().Sign() < 0 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment