diff options
author | Jordan Krage <jmank88@gmail.com> | 2018-12-20 21:00:58 +0800 |
---|---|---|
committer | Martin Holst Swende <martin@swende.se> | 2018-12-20 21:00:58 +0800 |
commit | 27ce4eb78bdf5d9b742ed05babe9b86a434733a1 (patch) | |
tree | 83adcb29e48cff8b27850e9aa9b9baeff67094e3 /core/tx_pool.go | |
parent | 5f251a6448b3385015ab531c35071743f93cafae (diff) | |
download | dexon-27ce4eb78bdf5d9b742ed05babe9b86a434733a1.tar dexon-27ce4eb78bdf5d9b742ed05babe9b86a434733a1.tar.gz dexon-27ce4eb78bdf5d9b742ed05babe9b86a434733a1.tar.bz2 dexon-27ce4eb78bdf5d9b742ed05babe9b86a434733a1.tar.lz dexon-27ce4eb78bdf5d9b742ed05babe9b86a434733a1.tar.xz dexon-27ce4eb78bdf5d9b742ed05babe9b86a434733a1.tar.zst dexon-27ce4eb78bdf5d9b742ed05babe9b86a434733a1.zip |
core: sanitize more TxPoolConfig fields (#17210)
* core: sanitize more TxPoolConfig fields
* core: fix TestTransactionPendingMinimumAllowance
Diffstat (limited to 'core/tx_pool.go')
-rw-r--r-- | core/tx_pool.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/core/tx_pool.go b/core/tx_pool.go index fc35d1f24..552d3692b 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -172,6 +172,26 @@ func (config *TxPoolConfig) sanitize() TxPoolConfig { log.Warn("Sanitizing invalid txpool price bump", "provided", conf.PriceBump, "updated", DefaultTxPoolConfig.PriceBump) conf.PriceBump = DefaultTxPoolConfig.PriceBump } + if conf.AccountSlots < 1 { + log.Warn("Sanitizing invalid txpool account slots", "provided", conf.AccountSlots, "updated", DefaultTxPoolConfig.AccountSlots) + conf.AccountSlots = DefaultTxPoolConfig.AccountSlots + } + if conf.GlobalSlots < 1 { + log.Warn("Sanitizing invalid txpool global slots", "provided", conf.GlobalSlots, "updated", DefaultTxPoolConfig.GlobalSlots) + conf.GlobalSlots = DefaultTxPoolConfig.GlobalSlots + } + if conf.AccountQueue < 1 { + log.Warn("Sanitizing invalid txpool account queue", "provided", conf.AccountQueue, "updated", DefaultTxPoolConfig.AccountQueue) + conf.AccountQueue = DefaultTxPoolConfig.AccountQueue + } + if conf.GlobalQueue < 1 { + log.Warn("Sanitizing invalid txpool global queue", "provided", conf.GlobalQueue, "updated", DefaultTxPoolConfig.GlobalQueue) + conf.GlobalQueue = DefaultTxPoolConfig.GlobalQueue + } + if conf.Lifetime < 1 { + log.Warn("Sanitizing invalid txpool lifetime", "provided", conf.Lifetime, "updated", DefaultTxPoolConfig.Lifetime) + conf.Lifetime = DefaultTxPoolConfig.Lifetime + } return conf } |