fix max gas price

This commit is contained in:
Alexey 2020-08-04 10:41:23 +03:00
parent 850cfb3f7e
commit 2d478c5108

@ -19,7 +19,7 @@ class Sender {
tx = JSON.parse(tx) tx = JSON.parse(tx)
if (Date.now() - tx.date > this.pendingTxTimeout) { if (Date.now() - tx.date > this.pendingTxTimeout) {
const newGasPrice = toBN(tx.gasPrice).mul(toBN(this.gasBumpPercentage)).div(toBN(100)) const newGasPrice = toBN(tx.gasPrice).mul(toBN(this.gasBumpPercentage)).div(toBN(100))
const maxGasPrice = toBN(toWei(config.maxGasPrice.toString())) const maxGasPrice = toBN(toWei(config.maxGasPrice.toString(), 'Gwei'))
tx.gasPrice = toHex(BN.min(newGasPrice, maxGasPrice)) tx.gasPrice = toHex(BN.min(newGasPrice, maxGasPrice))
tx.date = Date.now() tx.date = Date.now()
await redisClient.set('tx:' + tx.nonce, JSON.stringify(tx)) await redisClient.set('tx:' + tx.nonce, JSON.stringify(tx))