aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/withdraw.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-12-13 11:28:15 +0100
committerFlorian Dold <florian@dold.me>2021-12-13 11:28:15 +0100
commitc493a3069ec330b955efd8604cb9d8b76277c74e (patch)
tree32fb0ad5306f4e7000da4997c27a1abf3da96fcf /packages/taler-wallet-core/src/operations/withdraw.ts
parent38d8239f937de047f127d37cd23ca6829db8e3e4 (diff)
downloadwallet-core-c493a3069ec330b955efd8604cb9d8b76277c74e.tar.xz
wallet-core: reset reserve retry when resetting withdrawal retry
Diffstat (limited to 'packages/taler-wallet-core/src/operations/withdraw.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/withdraw.ts27
1 files changed, 24 insertions, 3 deletions
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts
index 48d308b60..652b26c1e 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -854,7 +854,10 @@ async function resetWithdrawalGroupRetry(
withdrawalGroupId: string,
): Promise<void> {
await ws.db
- .mktx((x) => ({ withdrawalGroups: x.withdrawalGroups }))
+ .mktx((x) => ({
+ withdrawalGroups: x.withdrawalGroups,
+ reserves: x.reserves,
+ }))
.runReadWrite(async (tx) => {
const x = await tx.withdrawalGroups.get(withdrawalGroupId);
if (x) {
@@ -879,8 +882,26 @@ async function processWithdrawGroupImpl(
return tx.withdrawalGroups.get(withdrawalGroupId);
});
if (!withdrawalGroup) {
- logger.trace("withdraw session doesn't exist");
- return;
+ // Withdrawal group doesn't exist yet, but reserve might exist
+ // (and reference the yet to be created withdrawal group)
+ const reservePub = await ws.db
+ .mktx((x) => ({ reserves: x.reserves }))
+ .runReadOnly(async (tx) => {
+ const r = await tx.reserves.indexes.byInitialWithdrawalGroupId.get(
+ withdrawalGroupId,
+ );
+ if (r) {
+ return r.reservePub;
+ }
+ return undefined;
+ });
+ if (!reservePub) {
+ logger.warn(
+ "withdrawal group doesn't exist (and reserve doesn't exist either)",
+ );
+ return;
+ }
+ return await ws.reserveOps.processReserve(ws, reservePub, forceNow);
}
await ws.exchangeOps.updateExchangeFromUrl(