diff --git a/zp-relayer/workers/sentTxWorker.ts b/zp-relayer/workers/sentTxWorker.ts index 2025b2f7..57401a32 100644 --- a/zp-relayer/workers/sentTxWorker.ts +++ b/zp-relayer/workers/sentTxWorker.ts @@ -69,9 +69,7 @@ export async function createSentTxWorker(gasPrice: Gas } // Transaction was not mined, but nonce was increased - // Should send for re-processing if (tx === null) { - logger.warn('Transaction was not mined, but nonce increased; tx should be re-processed') return [null, true] } @@ -89,9 +87,9 @@ export async function createSentTxWorker(gasPrice: Gas const [lastHash, lastGasPrice] = prevAttempts.at(-1) as SendAttempt if (shouldReprocess) { - logger.info('%s sending this job for re-processing...', logPrefix) - await poolTxQueue.add('reprocess', [job.data.txPayload]) - return [SentTxState.SKIPPED, lastHash, []] as SentTxResult + // TODO: handle this case later + // Error should be caught by `withLoop` to re-run job + throw new Error('Ambiguity detected: nonce increased but no respond that transaction was mined') } if (tx) { @@ -126,6 +124,14 @@ export async function createSentTxWorker(gasPrice: Gas logger.error('Commitments are not equal') } + const rootConfirmed = pool.state.getMerkleRoot() + logger.info(`Assert roots are equal`) + if (rootConfirmed !== root) { + // TODO: Should be impossible but in such case + // we should recover from some checkpoint + logger.error('Roots are not equal: %s should be %s', rootConfirmed, root) + } + return [SentTxState.MINED, txHash, []] as SentTxResult } else { // Revert