28125: check config.NoLocals on legacypool's validateTxBasics

This commit is contained in:
Juan Palacios 2023-10-26 15:19:29 +11:00
parent bffa606f63
commit d5848e3af9
No known key found for this signature in database
GPG key ID: 9CEE762FFEF26E1C
2 changed files with 8 additions and 2 deletions

View file

@ -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 {

View file

@ -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()