From d5067b94333bc2d7db29100b8aa223431213d3cd Mon Sep 17 00:00:00 2001 From: farhanW3 Date: Tue, 19 Sep 2023 11:57:04 -0700 Subject: [PATCH] added sentAtBlockNumber to be populated on DB when tx submitted --- worker/controller/processTransaction.ts | 13 +++++++++---- worker/controller/retryTransaction.ts | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/worker/controller/processTransaction.ts b/worker/controller/processTransaction.ts index 3df39ef54..eb4469924 100644 --- a/worker/controller/processTransaction.ts +++ b/worker/controller/processTransaction.ts @@ -56,10 +56,12 @@ export const processTransaction = async (): Promise => { pgtx, ); - let [blockchainNonce, gasData] = await Promise.all([ - sdk.wallet.getNonce("pending"), - getDefaultGasOverrides(sdk.getProvider()), - ]); + let [blockchainNonce, gasData, currentBlockNumber] = + await Promise.all([ + sdk.wallet.getNonce("pending"), + getDefaultGasOverrides(sdk.getProvider()), + sdk.getProvider().getBlockNumber(), + ]); // TODO: IMPORTANT: Proper nonce management logic! Add comments! let currentNonce = BigNumber.from(walletNonce?.nonce ?? 0); @@ -120,6 +122,9 @@ export const processTransaction = async (): Promise => { queueId: tx.queueId!, status: TransactionStatusEnum.Submitted, res: txRes, + txData: { + sentAtBlockNumber: currentBlockNumber, + }, }); logger.worker.info( `Transaction submitted for ${tx.queueId!} with Nonce ${txSubmittedNonce}, Tx Hash: ${ diff --git a/worker/controller/retryTransaction.ts b/worker/controller/retryTransaction.ts index d14e05a8e..014ec9007 100644 --- a/worker/controller/retryTransaction.ts +++ b/worker/controller/retryTransaction.ts @@ -147,6 +147,7 @@ export const retryTransactions = async () => { res: txRes, txData: { retryCount: txReceiptData.txData.retryCount + 1, + sentAtBlockNumber: currentBlockNumber, }, }); logger.worker.info(