aboutsummaryrefslogtreecommitdiffstats
path: root/core/tx_list.go
diff options
context:
space:
mode:
authorJim McDonald <Jim@mcdee.net>2017-10-30 19:05:00 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-10-30 19:05:00 +0800
commit0131bd6ff9b1850fdd307715c62174af4f05d2c7 (patch)
tree097b929fd5757137f6e56b39b9f7b8d2a7b4fa7c /core/tx_list.go
parentdd8a62683e2007b1127bfdc55c58c39f78b58ebf (diff)
downloadgo-tangerine-0131bd6ff9b1850fdd307715c62174af4f05d2c7.tar
go-tangerine-0131bd6ff9b1850fdd307715c62174af4f05d2c7.tar.gz
go-tangerine-0131bd6ff9b1850fdd307715c62174af4f05d2c7.tar.bz2
go-tangerine-0131bd6ff9b1850fdd307715c62174af4f05d2c7.tar.lz
go-tangerine-0131bd6ff9b1850fdd307715c62174af4f05d2c7.tar.xz
go-tangerine-0131bd6ff9b1850fdd307715c62174af4f05d2c7.tar.zst
go-tangerine-0131bd6ff9b1850fdd307715c62174af4f05d2c7.zip
core: respect price bump threshold (#15401)
* core: allow price bump at threshold * core: test changes to allow price bump at threshold * core: reinstate tx replacement test underneath threshold * core: minor test failure message cleanups
Diffstat (limited to 'core/tx_list.go')
-rw-r--r--core/tx_list.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/tx_list.go b/core/tx_list.go
index 2935929d7..838433b89 100644
--- a/core/tx_list.go
+++ b/core/tx_list.go
@@ -254,7 +254,10 @@ func (l *txList) Add(tx *types.Transaction, priceBump uint64) (bool, *types.Tran
old := l.txs.Get(tx.Nonce())
if old != nil {
threshold := new(big.Int).Div(new(big.Int).Mul(old.GasPrice(), big.NewInt(100+int64(priceBump))), big.NewInt(100))
- if threshold.Cmp(tx.GasPrice()) >= 0 {
+ // Have to ensure that the new gas price is higher than the old gas
+ // price as well as checking the percentage threshold to ensure that
+ // this is accurate for low (Wei-level) gas price replacements
+ if old.GasPrice().Cmp(tx.GasPrice()) >= 0 || threshold.Cmp(tx.GasPrice()) > 0 {
return false, nil
}
}