fix: add a margin of 0.001% on sweeping transactions to ensure higher success rate

This commit is contained in:
Sérgio Salgado 2022-08-02 22:10:26 +01:00
parent abddb165fe
commit 7dd395672a
2 changed files with 3 additions and 2 deletions

View file

@ -263,7 +263,7 @@ settingsLoader.loadLatest()
}
const opts = {
chainId: 3,
chainId: 1,
nonce: 0,
includesFee: true
}

View file

@ -10,6 +10,7 @@ const Tx = require('ethereumjs-tx')
const { default: PQueue } = require('p-queue')
const util = require('ethereumjs-util')
const coins = require('@lamassu/coins')
const { BigNumber } = require('bignumber.js')
const _pify = require('pify')
const BN = require('../../../bn')
@ -205,7 +206,7 @@ function generateTx (_toAddress, wallet, amount, includesFee, cryptoCode) {
lastUsedNonces[fromAddress] = txCount
const toSend = includesFee
? amount.minus(gasPrice.times(gas))
? new BN(amount.times(0.99999).toFixed(0, BigNumber.ROUND_DOWN)).minus(gasPrice.times(gas))
: amount
const maxPriorityFeePerGas = new BN(web3.utils.toWei('2.5', 'gwei')) // web3 default value