Do not reset nonce, if nothing was resent (#469)

This commit is contained in:
Kirill Fedoseev 2020-10-07 15:28:57 +03:00 committed by GitHub
parent aff8b777c5
commit 4efda98f2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -80,13 +80,17 @@ async function readNonce(forceUpdate) {
logger.debug({ nonce }, 'Nonce found in the DB')
return Number(nonce)
} else {
logger.debug("Nonce wasn't found in the DB")
logger.warn("Nonce wasn't found in the DB")
return getNonce(web3Instance, ORACLE_VALIDATOR_ADDRESS)
}
}
function updateNonce(nonce) {
return redis.set(nonceKey, nonce)
if (typeof nonce !== 'number') {
logger.warn('Given nonce value is not a valid number. Nothing will be updated in the DB.')
} else {
redis.set(nonceKey, nonce)
}
}
async function main({ msg, ackMsg, nackMsg, channel, scheduleForRetry, scheduleTransactionResend }) {