fix: add transaction ID to new sweep error logs
This commit is contained in:
parent
0f507d0a54
commit
3daf0ac865
4 changed files with 9 additions and 8 deletions
|
|
@ -789,9 +789,10 @@ function plugins (settings, deviceId) {
|
|||
}
|
||||
|
||||
function sweepHdRow (row) {
|
||||
const txId = row.id
|
||||
const cryptoCode = row.crypto_code
|
||||
|
||||
return wallet.sweep(settings, cryptoCode, row.hd_index)
|
||||
return wallet.sweep(settings, txId, cryptoCode, row.hd_index)
|
||||
.then(txHash => {
|
||||
if (txHash) {
|
||||
logger.debug('[%s] Swept address with tx: %s', cryptoCode, txHash)
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ function generateErc20Tx (_toAddress, wallet, amount, includesFee, cryptoCode) {
|
|||
const maxFeePerGas = new BN(2).times(baseFeePerGas).plus(maxPriorityFeePerGas)
|
||||
|
||||
if (includesFee && (toSend.isNegative() || toSend.isZero())) {
|
||||
throw new Error(`Trying to send a nil or negative amount. This is probably caused due to the estimated fee being higher than the address' balance. Value provided: ${toSend.toNumber()}`)
|
||||
throw new Error(`Trying to send a nil or negative amount (Transaction ID: ${txId} | Value provided: ${toSend.toNumber()}). This is probably caused due to the estimated fee being higher than the address' balance.`)
|
||||
}
|
||||
|
||||
const rawTx = {
|
||||
|
|
@ -184,7 +184,7 @@ function generateErc20Tx (_toAddress, wallet, amount, includesFee, cryptoCode) {
|
|||
})
|
||||
}
|
||||
|
||||
function generateTx (_toAddress, wallet, amount, includesFee, cryptoCode) {
|
||||
function generateTx (_toAddress, wallet, amount, includesFee, cryptoCode, txId) {
|
||||
const fromAddress = '0x' + wallet.getAddress().toString('hex')
|
||||
|
||||
const toAddress = _toAddress.toLowerCase()
|
||||
|
|
@ -251,7 +251,7 @@ function defaultAddress (account) {
|
|||
return defaultWallet(account).getChecksumAddressString()
|
||||
}
|
||||
|
||||
function sweep (account, cryptoCode, hdIndex, settings, operatorId) {
|
||||
function sweep (account, txId, cryptoCode, hdIndex, settings, operatorId) {
|
||||
const wallet = paymentHdNode(account).deriveChild(hdIndex).getWallet()
|
||||
const fromAddress = wallet.getChecksumAddressString()
|
||||
|
||||
|
|
@ -259,7 +259,7 @@ function sweep (account, cryptoCode, hdIndex, settings, operatorId) {
|
|||
.then(r => {
|
||||
if (r.eq(0)) return
|
||||
|
||||
return generateTx(defaultAddress(account), wallet, r, true, cryptoCode)
|
||||
return generateTx(defaultAddress(account), wallet, r, true, cryptoCode, txId)
|
||||
.then(signedTx => pify(web3.eth.sendSignedTransaction)(signedTx))
|
||||
})
|
||||
)
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ function newFunding (account, cryptoCode, settings, operatorId) {
|
|||
throw new E.NotImplementedError()
|
||||
}
|
||||
|
||||
function sweep (account, cryptoCode, hdIndex, settings, operatorId) {
|
||||
function sweep (account, txId, cryptoCode, hdIndex, settings, operatorId) {
|
||||
throw new E.NotImplementedError()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -206,9 +206,9 @@ function getStatus (settings, tx, machineId) {
|
|||
})
|
||||
}
|
||||
|
||||
function sweep (settings, cryptoCode, hdIndex) {
|
||||
function sweep (settings, txId, cryptoCode, hdIndex) {
|
||||
return fetchWallet(settings, cryptoCode)
|
||||
.then(r => r.wallet.sweep(r.account, cryptoCode, hdIndex, settings, r.operatorId))
|
||||
.then(r => r.wallet.sweep(r.account, txId, cryptoCode, hdIndex, settings, r.operatorId))
|
||||
}
|
||||
|
||||
function isHd (settings, tx) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue