Merge pull request #99 from poanetwork/oracle-nonce-too-low
Handle 'nonce too low' error message on oracle sender
This commit is contained in:
commit
2b3b2d41ce
@ -13,7 +13,8 @@ const {
|
|||||||
privateKeyToAddress,
|
privateKeyToAddress,
|
||||||
syncForEach,
|
syncForEach,
|
||||||
waitForFunds,
|
waitForFunds,
|
||||||
watchdog
|
watchdog,
|
||||||
|
nonceError
|
||||||
} = require('./utils/utils')
|
} = require('./utils/utils')
|
||||||
const { EXIT_CODES, EXTRA_GAS_PERCENTAGE } = require('./utils/constants')
|
const { EXIT_CODES, EXTRA_GAS_PERCENTAGE } = require('./utils/constants')
|
||||||
|
|
||||||
@ -152,10 +153,7 @@ async function main({ msg, ackMsg, nackMsg, sendToQueue, channel }) {
|
|||||||
logger.error(
|
logger.error(
|
||||||
`Insufficient funds: ${currentBalance}. Stop processing messages until the balance is at least ${minimumBalance}.`
|
`Insufficient funds: ${currentBalance}. Stop processing messages until the balance is at least ${minimumBalance}.`
|
||||||
)
|
)
|
||||||
} else if (
|
} else if (nonceError(e)) {
|
||||||
e.message.includes('Transaction nonce is too low') ||
|
|
||||||
e.message.includes('transaction with same nonce in the queue')
|
|
||||||
) {
|
|
||||||
nonce = await readNonce(true)
|
nonce = await readNonce(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,14 @@ function privateKeyToAddress(privateKey) {
|
|||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nonceError(e) {
|
||||||
|
return (
|
||||||
|
e.message.includes('Transaction nonce is too low') ||
|
||||||
|
e.message.includes('nonce too low') ||
|
||||||
|
e.message.includes('transaction with same nonce in the queue')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
syncForEach,
|
syncForEach,
|
||||||
checkHTTPS,
|
checkHTTPS,
|
||||||
@ -103,5 +111,6 @@ module.exports = {
|
|||||||
addExtraGas,
|
addExtraGas,
|
||||||
setIntervalAndRun,
|
setIntervalAndRun,
|
||||||
watchdog,
|
watchdog,
|
||||||
privateKeyToAddress
|
privateKeyToAddress,
|
||||||
|
nonceError
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user