mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Addressing PR feedback. Now setting local = false when NoLocals is set
This commit is contained in:
parent
ee8097e44d
commit
827f7e693f
2 changed files with 10 additions and 6 deletions
|
|
@ -152,10 +152,6 @@ var DefaultConfig = Config{
|
||||||
Lifetime: 3 * time.Hour,
|
Lifetime: 3 * time.Hour,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (config *Config) PrioritizeLocals() bool {
|
|
||||||
return !config.NoLocals
|
|
||||||
}
|
|
||||||
|
|
||||||
// sanitize checks the provided user configurations and changes anything that's
|
// sanitize checks the provided user configurations and changes anything that's
|
||||||
// unreasonable or unworkable.
|
// unreasonable or unworkable.
|
||||||
func (config *Config) sanitize() Config {
|
func (config *Config) sanitize() Config {
|
||||||
|
|
@ -600,8 +596,8 @@ func (pool *LegacyPool) validateTxBasics(tx *types.Transaction, local bool) erro
|
||||||
MaxSize: txMaxSize,
|
MaxSize: txMaxSize,
|
||||||
MinTip: pool.gasTip.Load(),
|
MinTip: pool.gasTip.Load(),
|
||||||
}
|
}
|
||||||
if local && pool.config.PrioritizeLocals() {
|
if local && pool.config.NoLocals {
|
||||||
opts.MinTip = new(big.Int)
|
local = false
|
||||||
}
|
}
|
||||||
if err := txpool.ValidateTransaction(tx, pool.currentHead.Load(), pool.signer, opts); err != nil {
|
if err := txpool.ValidateTransaction(tx, pool.currentHead.Load(), pool.signer, opts); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
|
|
@ -1515,12 +1515,20 @@ func TestMinGasPriceEnforced(t *testing.T) {
|
||||||
t.Fatalf("Min tip not enforced")
|
t.Fatalf("Min tip not enforced")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := pool.Add([]*txpool.Transaction{{Tx: tx}}, true, false)[0]; !errors.Is(err, txpool.ErrUnderpriced) {
|
||||||
|
t.Fatalf("Min tip not enforced")
|
||||||
|
}
|
||||||
|
|
||||||
tx = dynamicFeeTx(0, 100000, big.NewInt(3), big.NewInt(2), key)
|
tx = dynamicFeeTx(0, 100000, big.NewInt(3), big.NewInt(2), key)
|
||||||
pool.SetGasTip(big.NewInt(tx.GasTipCap().Int64() + 1))
|
pool.SetGasTip(big.NewInt(tx.GasTipCap().Int64() + 1))
|
||||||
|
|
||||||
if err := pool.addLocal(tx); !errors.Is(err, txpool.ErrUnderpriced) {
|
if err := pool.addLocal(tx); !errors.Is(err, txpool.ErrUnderpriced) {
|
||||||
t.Fatalf("Min tip not enforced")
|
t.Fatalf("Min tip not enforced")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := pool.Add([]*txpool.Transaction{{Tx: tx}}, true, false)[0]; !errors.Is(err, txpool.ErrUnderpriced) {
|
||||||
|
t.Fatalf("Min tip not enforced")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that setting the transaction pool gas price to a higher value correctly
|
// Tests that setting the transaction pool gas price to a higher value correctly
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue