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

This commit is contained in:
Daniel Liu 2025-12-11 18:48:18 +08:00 committed by GitHub
parent a3282d4119
commit d8aac24223
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -626,6 +626,10 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
if tx.Size() > txMaxSize {
return ErrOversizedData
}
// Check whether the init code size has been exceeded.
if pool.eip1559 && tx.To() == nil && len(tx.Data()) > params.MaxInitCodeSize {
return fmt.Errorf("%w: code size %v limit %v", core.ErrMaxInitCodeSizeExceeded, len(tx.Data()), params.MaxInitCodeSize)
}
// Get current block number
var number *big.Int = nil
if pool.chain.CurrentHeader() != nil {