From ee47aa4837fedcaa8257b57138ea34fda220d2b7 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 3 Aug 2023 19:24:04 +0200 Subject: fix integration tests Instead of using the deprecated runUntilDone, we now wait for specific notifications. The old way doesn't work, since p2p push transactions are not considered done until the counterparty has accepted the payment. --- .../taler-wallet-core/src/operations/pay-peer-pull-credit.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'packages/taler-wallet-core/src') diff --git a/packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts b/packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts index c7e13754f..ac501aae2 100644 --- a/packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts +++ b/packages/taler-wallet-core/src/operations/pay-peer-pull-credit.ts @@ -436,16 +436,25 @@ async function handlePeerPullCreditCreatePurse( logger.info(`reserve merge response: ${j2s(resp)}`); - await ws.db + const transactionId = constructTransactionIdentifier({ + tag: TransactionType.PeerPullCredit, + pursePub: pullIni.pursePub, + }); + + const transitionInfo = await ws.db .mktx((x) => [x.peerPullPaymentInitiations]) .runReadWrite(async (tx) => { const pi2 = await tx.peerPullPaymentInitiations.get(pursePub); if (!pi2) { return; } + const oldTxState = computePeerPullCreditTransactionState(pi2); pi2.status = PeerPullPaymentInitiationStatus.PendingReady; await tx.peerPullPaymentInitiations.put(pi2); + const newTxState = computePeerPullCreditTransactionState(pi2); + return { oldTxState, newTxState }; }); + notifyTransition(ws, transactionId, transitionInfo); return TaskRunResult.finished(); } -- cgit v1.2.3