Skip to content

Commit

Permalink
fix: add prevTransactionHash query unprocessed
Browse files Browse the repository at this point in the history
  • Loading branch information
ducphamle2 committed Sep 30, 2024
1 parent 0ae95c3 commit 3a05eba
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/ton-to-cw/src/tx-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,15 @@ export default class TonTxProcessor {
(tx) => tx.tx.hash().toString("hex") === this.latestProcessedTxHash
);
if (indexOf === -1) {
const oldestTx = txs[txs.length - 1].tx;
if (!oldestTx.prevTransactionHash) {
this.logger.error(
"TonTxProcessor queryUnprocessedTransactions new offset hash is undefined"
);
continue;
}
transactions.push(...txs);
// increase offset and continue querying txs until we find our oldest transaction that we can remember
const oldestTx = txs[txs.length - 1].tx;
offset = {
hash: oldestTx.prevTransactionHash.toString(16),
lt: oldestTx.prevTransactionLt.toString(10),
Expand Down

0 comments on commit 3a05eba

Please sign in to comment.