Skip to content

Commit 6b43936

Browse files
authored
added sentAtBlockNumber to be populated on DB when tx submitted (#147)
1 parent dffb702 commit 6b43936

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

worker/controller/processTransaction.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ export const processTransaction = async (): Promise<string[]> => {
5656
pgtx,
5757
);
5858

59-
let [blockchainNonce, gasData] = await Promise.all([
60-
sdk.wallet.getNonce("pending"),
61-
getDefaultGasOverrides(sdk.getProvider()),
62-
]);
59+
let [blockchainNonce, gasData, currentBlockNumber] =
60+
await Promise.all([
61+
sdk.wallet.getNonce("pending"),
62+
getDefaultGasOverrides(sdk.getProvider()),
63+
sdk.getProvider().getBlockNumber(),
64+
]);
6365

6466
// TODO: IMPORTANT: Proper nonce management logic! Add comments!
6567
let currentNonce = BigNumber.from(walletNonce?.nonce ?? 0);
@@ -120,6 +122,9 @@ export const processTransaction = async (): Promise<string[]> => {
120122
queueId: tx.queueId!,
121123
status: TransactionStatusEnum.Submitted,
122124
res: txRes,
125+
txData: {
126+
sentAtBlockNumber: currentBlockNumber,
127+
},
123128
});
124129
logger.worker.info(
125130
`Transaction submitted for ${tx.queueId!} with Nonce ${txSubmittedNonce}, Tx Hash: ${

worker/controller/retryTransaction.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ export const retryTransactions = async () => {
147147
res: txRes,
148148
txData: {
149149
retryCount: txReceiptData.txData.retryCount + 1,
150+
sentAtBlockNumber: currentBlockNumber,
150151
},
151152
});
152153
logger.worker.info(

0 commit comments

Comments
 (0)