Skip to content

Commit 8636988

Browse files
committed
fix: waitForIndexer waiting for transactions that failed
1 parent 0611b81 commit 8636988

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/testing/fixtures/algorand-fixture.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export function algorandFixture(fixtureConfig?: AlgorandFixtureConfig, config?:
111111
return account
112112
},
113113
transactionLogger: transactionLogger,
114-
waitForIndexer: () => transactionLogger.waitForIndexer(indexer),
114+
waitForIndexer: () => transactionLogger.waitForIndexer(algod, indexer),
115115
waitForIndexerTransaction: (transactionId: string) => runWhenIndexerCaughtUp(() => indexer.lookupTransactionByID(transactionId).do()),
116116
}
117117
}

src/testing/transaction-logger.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ export class TransactionLogger {
4949
return new Proxy<Algodv2>(algod, new TransactionLoggingAlgodv2ProxyHandler(this))
5050
}
5151

52-
/** Wait until all logged transactions IDs appear in the given `Indexer`. */
53-
async waitForIndexer(indexer: Indexer) {
54-
await Promise.all(this._sentTransactionIds.map((txnId) => runWhenIndexerCaughtUp(() => indexer.lookupTransactionByID(txnId).do())))
52+
/** Wait until indexer has the last round from algod. */
53+
async waitForIndexer(algod: Algodv2, indexer: Indexer) {
54+
const round = (await algod.status().do()).lastRound
55+
await runWhenIndexerCaughtUp(() => indexer.lookupBlock(round).do())
5556
}
5657
}
5758

0 commit comments

Comments
 (0)