summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-11-15 23:41:02 +0100
committerFlorian Dold <florian@dold.me>2023-11-15 23:41:09 +0100
commite4a1b373b018d7528828954ff8da96fe6b5f9728 (patch)
treebc922cb2fd206185dd5ccaf3f4fdd8ca7c047a67 /packages/taler-wallet-core/src/operations
parent07ff0c5a3781ff683f68f9821e9c94e02359791a (diff)
downloadwallet-core-e4a1b373b018d7528828954ff8da96fe6b5f9728.tar.gz
wallet-core-e4a1b373b018d7528828954ff8da96fe6b5f9728.tar.bz2
wallet-core-e4a1b373b018d7528828954ff8da96fe6b5f9728.zip
wallet-core: remove bogus exception
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
-rw-r--r--packages/taler-wallet-core/src/operations/refresh.ts16
1 files changed, 7 insertions, 9 deletions
diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts
index 95aedbbd6..3afdd2d71 100644
--- a/packages/taler-wallet-core/src/operations/refresh.ts
+++ b/packages/taler-wallet-core/src/operations/refresh.ts
@@ -298,7 +298,7 @@ async function provideRefreshSession(
const sessionSecretSeed = encodeCrock(getRandomBytes(64));
// Store refresh session for this coin in the database.
- const newSession = await ws.db
+ const mySession = await ws.db
.mktx((x) => [x.refreshGroups, x.coins, x.refreshSessions])
.runReadWrite(async (tx) => {
const rg = await tx.refreshGroups.get(refreshGroupId);
@@ -310,7 +310,7 @@ async function provideRefreshSession(
coinIndex,
]);
if (existingSession) {
- return;
+ return existingSession;
}
const newSession: RefreshSessionRecord = {
coinIndex,
@@ -327,9 +327,9 @@ async function provideRefreshSession(
return newSession;
});
logger.trace(
- `created refresh session for coin #${coinIndex} in ${refreshGroupId}`,
+ `found/created refresh session for coin #${coinIndex} in ${refreshGroupId}`,
);
- return newSession;
+ return mySession;
}
function getRefreshRequestTimeout(rg: RefreshGroupRecord): Duration {
@@ -918,11 +918,9 @@ async function processRefreshSession(
refreshSession = await provideRefreshSession(ws, refreshGroupId, coinIndex);
}
if (!refreshSession) {
- if (refreshGroup.statusPerCoin[coinIndex] !== RefreshCoinStatus.Finished) {
- throw Error(
- "BUG: refresh session was not created and coin not marked as finished",
- );
- }
+ // We tried to create the refresh session, but didn't get a result back.
+ // This means that either the session is finished, or that creating
+ // one isn't necessary.
return;
}
if (refreshSession.norevealIndex === undefined) {