diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-07-05 22:06:05 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-07-05 22:06:05 +0800 |
commit | 5e38f7a664aa5401117f1e1705ec97476b19411e (patch) | |
tree | 816c746189410b150636f99271f9c41d7cd903c3 /core | |
parent | 4c1d0b164b61f0ab17c899061c04b7b48a9d20a8 (diff) | |
download | dexon-5e38f7a664aa5401117f1e1705ec97476b19411e.tar dexon-5e38f7a664aa5401117f1e1705ec97476b19411e.tar.gz dexon-5e38f7a664aa5401117f1e1705ec97476b19411e.tar.bz2 dexon-5e38f7a664aa5401117f1e1705ec97476b19411e.tar.lz dexon-5e38f7a664aa5401117f1e1705ec97476b19411e.tar.xz dexon-5e38f7a664aa5401117f1e1705ec97476b19411e.tar.zst dexon-5e38f7a664aa5401117f1e1705ec97476b19411e.zip |
cmd, core: add --txpool.nolocals to disable local price exemptions
Diffstat (limited to 'core')
-rw-r--r-- | core/tx_pool.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/tx_pool.go b/core/tx_pool.go index a8018d74f..093d3c5fd 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -99,6 +99,8 @@ type stateFn func() (*state.StateDB, error) // TxPoolConfig are the configuration parameters of the transaction pool. type TxPoolConfig struct { + NoLocals bool // Whether local transaction handling should be disabled + PriceLimit uint64 // Minimum gas price to enforce for acceptance into the pool PriceBump uint64 // Minimum price bump percentage to replace an already existing transaction (nonce) @@ -394,7 +396,7 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { } // Drop non-local transactions under our own minimal accepted gas price local = local || pool.locals.contains(from) // account may be local even if the transaction arrived from the network - if !local && pool.gasPrice.Cmp(tx.GasPrice()) > 0 { + if (!local || pool.config.NoLocals) && pool.gasPrice.Cmp(tx.GasPrice()) > 0 { return ErrUnderpriced } // Ensure the transaction adheres to nonce ordering @@ -480,7 +482,7 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (bool, error) { if err != nil { return false, err } - if local { + if local && !pool.config.NoLocals { pool.locals.add(from) } log.Trace("Pooled new future transaction", "hash", hash, "from", from, "to", tx.To()) |