core/txpool: add setcode tx to filter list of accepted txs

This commit is contained in:
lightclient 2025-01-27 09:03:00 -07:00
parent e3223c8ec5
commit 418e96b958
No known key found for this signature in database
GPG key ID: 657913021EF45A6A
2 changed files with 1 additions and 14 deletions

View file

@ -266,7 +266,7 @@ func New(config Config, chain BlockChain) *LegacyPool {
// pool, specifically, whether it is a Legacy, AccessList or Dynamic transaction. // pool, specifically, whether it is a Legacy, AccessList or Dynamic transaction.
func (pool *LegacyPool) Filter(tx *types.Transaction) bool { func (pool *LegacyPool) Filter(tx *types.Transaction) bool {
switch tx.Type() { switch tx.Type() {
case types.LegacyTxType, types.AccessListTxType, types.DynamicFeeTxType: case types.LegacyTxType, types.AccessListTxType, types.DynamicFeeTxType, types.SetCodeTxType:
return true return true
default: default:
return false return false

View file

@ -2224,19 +2224,6 @@ func TestSetCodeTransactions(t *testing.T) {
testAddBalance(pool, addrB, big.NewInt(params.Ether)) testAddBalance(pool, addrB, big.NewInt(params.Ether))
testAddBalance(pool, addrC, big.NewInt(params.Ether)) testAddBalance(pool, addrC, big.NewInt(params.Ether))
// A few situations to test:
// 1. Accounts with delegation set can only have one in-flight transaction.
// 2. Setcode tx should be rejected if any authority has a known pooled tx.
// 3. New txs from senders with pooled delegations should not be accepted.
// 4. Ensure setcode tx can replace itself provided the fee bump is enough.
// 5. Make sure that if a setcode tx is replaced, the auths associated with
// the tx are removed.
// 5.1. This should also work when a self-sponsored setcode tx attempts
// to replace itself.
// make sure auth list recreated correctly after full reorg?
// (in different test?) verify that a setcode tx cannot invalidate a blob tx.
for _, tt := range []struct { for _, tt := range []struct {
name string name string
pending int pending int