diff --git a/oracle/src/sender.js b/oracle/src/sender.js index 172631a5..659d0b5f 100644 --- a/oracle/src/sender.js +++ b/oracle/src/sender.js @@ -173,15 +173,18 @@ async function main({ msg, ackMsg, nackMsg, channel, scheduleForRetry, scheduleT `Tx Failed for event Tx ${job.transactionReference}.`, e.message ) - if (!e.message.toLowerCase().includes('transaction with the same hash was already imported')) { - if (isResend) { - resendJobs.push(job) - } else { - failedTx.push(job) - } + + const message = e.message.toLowerCase() + if (isResend || message.includes('transaction with the same hash was already imported')) { + resendJobs.push(job) + } else { + // if initial transaction sending has failed not due to the same hash error + // send it to the failed tx queue + // this will result in the sooner resend attempt than if using resendJobs + failedTx.push(job) } - if (e.message.toLowerCase().includes('insufficient funds')) { + if (message.includes('insufficient funds')) { insufficientFunds = true const currentBalance = await web3Instance.eth.getBalance(ORACLE_VALIDATOR_ADDRESS) minimumBalance = gasLimit.multipliedBy(gasPrice)