aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/balance.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-01-08 18:51:38 +0100
committerFlorian Dold <florian@dold.me>2024-01-08 18:51:45 +0100
commit2987f6f8365a15c6761a370bfd0ebf0952ce3f66 (patch)
treecbaf22fb5a44efced31de485c3658edbbbc98731 /packages/taler-wallet-core/src/operations/balance.ts
parentb0610d24571593909cd6683b340fa266de046e31 (diff)
downloadwallet-core-2987f6f8365a15c6761a370bfd0ebf0952ce3f66.tar.xz
wallet-core: fix error reporting for exchange entries
Diffstat (limited to 'packages/taler-wallet-core/src/operations/balance.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/balance.ts15
1 files changed, 11 insertions, 4 deletions
diff --git a/packages/taler-wallet-core/src/operations/balance.ts b/packages/taler-wallet-core/src/operations/balance.ts
index 1b6ff7844..fdaab0d5f 100644
--- a/packages/taler-wallet-core/src/operations/balance.ts
+++ b/packages/taler-wallet-core/src/operations/balance.ts
@@ -63,11 +63,12 @@ import {
ScopeType,
} from "@gnu-taler/taler-util";
import {
- depositOperationNonfinalStatusRange,
DepositOperationStatus,
+ OPERATION_STATUS_ACTIVE_FIRST,
+ OPERATION_STATUS_ACTIVE_LAST,
RefreshGroupRecord,
+ RefreshOperationStatus,
WalletStoresV1,
- withdrawalGroupNonfinalRange,
WithdrawalGroupStatus,
} from "../db.js";
import { InternalWalletState } from "../internal-wallet-state.js";
@@ -75,6 +76,7 @@ import { assertUnreachable } from "../util/assertUnreachable.js";
import { checkLogicInvariant } from "../util/invariants.js";
import { GetReadOnlyAccess } from "../util/query.js";
import { getExchangeDetails } from "./exchanges.js";
+import { GlobalIDB } from "@gnu-taler/idb-bridge";
/**
* Logger.
@@ -142,6 +144,11 @@ export async function getBalancesInsideTransaction(
return balanceStore[currency];
};
+ const keyRangeActive = GlobalIDB.KeyRange.bound(
+ OPERATION_STATUS_ACTIVE_FIRST,
+ OPERATION_STATUS_ACTIVE_LAST,
+ );
+
await tx.coinAvailability.iter().forEach((ca) => {
const b = initBalance(ca.currency);
const count = ca.visibleCoinCount ?? 0;
@@ -159,7 +166,7 @@ export async function getBalancesInsideTransaction(
});
await tx.withdrawalGroups.indexes.byStatus
- .iter(withdrawalGroupNonfinalRange)
+ .iter(keyRangeActive)
.forEach((wgRecord) => {
const b = initBalance(
Amounts.currencyOf(wgRecord.denomsSel.totalWithdrawCost),
@@ -205,7 +212,7 @@ export async function getBalancesInsideTransaction(
// FIXME: Use indexing to filter out final transactions.
await tx.depositGroups.indexes.byStatus
- .iter(depositOperationNonfinalStatusRange)
+ .iter(keyRangeActive)
.forEach((dgRecord) => {
const b = initBalance(Amounts.currencyOf(dgRecord.amount));
switch (dgRecord.operationStatus) {