From d5848e3af9110be365d3587d1bddeafa1d8f12b9 Mon Sep 17 00:00:00 2001 From: Juan Palacios Date: Thu, 26 Oct 2023 15:19:29 +1100 Subject: [PATCH] 28125: check config.NoLocals on legacypool's validateTxBasics --- core/txpool/legacypool/legacypool.go | 2 +- core/txpool/legacypool/legacypool_test.go | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 0e33923274..618e4711c2 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -596,7 +596,7 @@ func (pool *LegacyPool) validateTxBasics(tx *types.Transaction, local bool) erro MaxSize: txMaxSize, MinTip: pool.gasTip.Load(), } - if local { + if local && !pool.config.NoLocals { opts.MinTip = new(big.Int) } if err := txpool.ValidateTransaction(tx, pool.currentHead.Load(), pool.signer, opts); err != nil { diff --git a/core/txpool/legacypool/legacypool_test.go b/core/txpool/legacypool/legacypool_test.go index c98f0ea69d..a3d5cb5ac1 100644 --- a/core/txpool/legacypool/legacypool_test.go +++ b/core/txpool/legacypool/legacypool_test.go @@ -1496,7 +1496,13 @@ func TestMinGasPriceEnforced(t *testing.T) { t.Parallel() // Create the pool to test the pricing enforcement with - pool, _ := setupPoolWithConfig(eip1559Config) + statedb, _ := state.New(types.EmptyRootHash, state.NewDatabase(rawdb.NewMemoryDatabase()), nil) + blockchain := newTestBlockChain(eip1559Config, 10000000, statedb, new(event.Feed)) + + txPoolConfig := DefaultConfig + txPoolConfig.NoLocals = true + pool := New(txPoolConfig, blockchain) + pool.Init(new(big.Int).SetUint64(txPoolConfig.PriceLimit), blockchain.CurrentBlock(), makeAddressReserver()) defer pool.Close() key, _ := crypto.GenerateKey()