Skip to content

Commit

Permalink
core/txpool: reject SetCodeTxType txs before prague
Browse files Browse the repository at this point in the history
  • Loading branch information
buddh0 committed Dec 23, 2024
1 parent bda8ffd commit 0f58476
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions core/txpool/legacypool/legacypool.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ func New(config Config, chain BlockChain) *LegacyPool {
// pool, specifically, whether it is a Legacy, AccessList or Dynamic transaction.
func (pool *LegacyPool) Filter(tx *types.Transaction) bool {
switch tx.Type() {
//TODO(Nathan): add SetCodeTxType into LegacyPool for test, finally will rollback and be consistent with upstream
// TODO(Nathan): add SetCodeTxType into LegacyPool for test
// finally will rollback and be consistent with upstream
case types.LegacyTxType, types.AccessListTxType, types.DynamicFeeTxType, types.SetCodeTxType:
return true
default:
Expand Down Expand Up @@ -688,12 +689,17 @@ func (pool *LegacyPool) validateTxBasics(tx *types.Transaction, local bool) erro
Accept: 0 |
1<<types.LegacyTxType |
1<<types.AccessListTxType |
1<<types.DynamicFeeTxType |
1<<types.SetCodeTxType,
1<<types.DynamicFeeTxType,
MaxSize: txMaxSize,
MinTip: pool.gasTip.Load().ToBig(),
MaxGas: pool.GetMaxGas(),
}
// TODO(Nathan): ensure before prague, no SetCodeTxType will be accepted and propagated
// finally will rollback and be consistent with upstream
currentBlock := pool.chain.CurrentBlock()
if pool.chainconfig.IsPrague(currentBlock.Number, currentBlock.Time) {
opts.Accept |= 1 << types.SetCodeTxType
}
if local {
opts.MinTip = new(big.Int)
}
Expand Down

0 comments on commit 0f58476

Please sign in to comment.