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
This commit is contained in:
committed by
Péter Szilágyi
parent
dd8a62683e
commit
0131bd6ff9
@ -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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user