From 2ae952cdfa8f38a650be8e4438c21bace2f24c19 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 8 Sep 2023 12:54:31 +0200 Subject: wallet-core: remove redundant deposit status field in DB --- .../taler-wallet-core/src/operations/pending.ts | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'packages/taler-wallet-core/src/operations/pending.ts') diff --git a/packages/taler-wallet-core/src/operations/pending.ts b/packages/taler-wallet-core/src/operations/pending.ts index 207e6ffda..6115f848b 100644 --- a/packages/taler-wallet-core/src/operations/pending.ts +++ b/packages/taler-wallet-core/src/operations/pending.ts @@ -46,6 +46,7 @@ import { RefundGroupStatus, ExchangeEntryDbUpdateStatus, RefreshOperationStatus, + DepositElementStatus, } from "../db.js"; import { PendingOperationsResponse, @@ -277,8 +278,8 @@ async function gatherDepositPending( ): Promise { await iterRecordsForDeposit(tx, { onlyState: "nonfinal" }, async (dg) => { let deposited = true; - for (const d of dg.depositedPerCoin) { - if (!d) { + for (const d of dg.statusPerCoin) { + if (d === DepositElementStatus.DepositPending) { deposited = false; } } @@ -480,9 +481,7 @@ export async function iterRecordsForPeerPullInitiation( PeerPullPaymentCreditStatus.PendingCreatePurse, PeerPullPaymentCreditStatus.AbortingDeletePurse, ); - await tx.peerPullCredit.indexes.byStatus - .iter(keyRange) - .forEachAsync(f); + await tx.peerPullCredit.indexes.byStatus.iter(keyRange).forEachAsync(f); } else { await tx.peerPullCredit.indexes.byStatus.iter().forEachAsync(f); } @@ -528,9 +527,7 @@ export async function iterRecordsForPeerPullDebit( PeerPullDebitRecordStatus.PendingDeposit, PeerPullDebitRecordStatus.AbortingRefresh, ); - await tx.peerPullDebit.indexes.byStatus - .iter(keyRange) - .forEachAsync(f); + await tx.peerPullDebit.indexes.byStatus.iter(keyRange).forEachAsync(f); } else { await tx.peerPullDebit.indexes.byStatus.iter().forEachAsync(f); } @@ -576,9 +573,7 @@ export async function iterRecordsForPeerPushInitiation( PeerPushDebitStatus.PendingCreatePurse, PeerPushDebitStatus.AbortingRefresh, ); - await tx.peerPushDebit.indexes.byStatus - .iter(keyRange) - .forEachAsync(f); + await tx.peerPushDebit.indexes.byStatus.iter(keyRange).forEachAsync(f); } else { await tx.peerPushDebit.indexes.byStatus.iter().forEachAsync(f); } @@ -624,9 +619,7 @@ export async function iterRecordsForPeerPushCredit( PeerPushCreditStatus.PendingMerge, PeerPushCreditStatus.PendingWithdrawing, ); - await tx.peerPushCredit.indexes.byStatus - .iter(keyRange) - .forEachAsync(f); + await tx.peerPushCredit.indexes.byStatus.iter(keyRange).forEachAsync(f); } else { await tx.peerPushCredit.indexes.byStatus.iter().forEachAsync(f); } -- cgit v1.2.3