aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-06-05 19:09:29 +0200
committerFlorian Dold <florian@dold.me>2024-06-05 19:09:29 +0200
commit7631db2a902664f475b9074e305a95b0ad71a9df (patch)
treec41368796457bcaf581ee14de3141288db46d6e4 /packages
parent54933e533d2d650f3ffe4f443c6ff1a662e053c8 (diff)
downloadwallet-core-7631db2a902664f475b9074e305a95b0ad71a9df.tar.xz
wallet-core: fail refresh when denomination is unknown to exchange
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-wallet-core/src/refresh.ts23
1 files changed, 18 insertions, 5 deletions
diff --git a/packages/taler-wallet-core/src/refresh.ts b/packages/taler-wallet-core/src/refresh.ts
index f160e0731..7dcb755be 100644
--- a/packages/taler-wallet-core/src/refresh.ts
+++ b/packages/taler-wallet-core/src/refresh.ts
@@ -537,7 +537,10 @@ async function destroyRefreshSession(
denom,
oldCoin.maxAge,
);
- checkDbInvariant(car.pendingRefreshOutputCount != null, `no pendingRefreshOutputCount for denom ${dph}`);
+ checkDbInvariant(
+ car.pendingRefreshOutputCount != null,
+ `no pendingRefreshOutputCount for denom ${dph}`,
+ );
car.pendingRefreshOutputCount =
car.pendingRefreshOutputCount - refreshSession.newDenoms[i].count;
await tx.coinAvailability.put(car);
@@ -905,6 +908,7 @@ async function handleRefreshMeltNotFound(
// with the coin.
switch (errDetails.code) {
case TalerErrorCode.EXCHANGE_GENERIC_COIN_UNKNOWN:
+ case TalerErrorCode.EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN:
break;
default:
throwUnexpectedRequestError(resp, errDetails);
@@ -1250,7 +1254,10 @@ async function refreshReveal(
coin.exchangeBaseUrl,
coin.denomPubHash,
);
- checkDbInvariant(!!denomInfo, `no denom with hash ${coin.denomPubHash}`);
+ checkDbInvariant(
+ !!denomInfo,
+ `no denom with hash ${coin.denomPubHash}`,
+ );
const car = await getCoinAvailabilityForDenom(
wex,
tx,
@@ -1260,7 +1267,7 @@ async function refreshReveal(
checkDbInvariant(
car.pendingRefreshOutputCount != null &&
car.pendingRefreshOutputCount > 0,
- `no pendingRefreshOutputCount for denom ${coin.denomPubHash} age ${coin.maxAge}`
+ `no pendingRefreshOutputCount for denom ${coin.denomPubHash} age ${coin.maxAge}`,
);
car.pendingRefreshOutputCount--;
car.freshCoinCount++;
@@ -1568,8 +1575,14 @@ async function applyRefreshToOldCoins(
coin.denomPubHash,
coin.maxAge,
]);
- checkDbInvariant(!!coinAv, `no denom info for ${coin.denomPubHash} age ${coin.maxAge}`);
- checkDbInvariant(coinAv.freshCoinCount > 0, `no fresh coins for ${coin.denomPubHash}`);
+ checkDbInvariant(
+ !!coinAv,
+ `no denom info for ${coin.denomPubHash} age ${coin.maxAge}`,
+ );
+ checkDbInvariant(
+ coinAv.freshCoinCount > 0,
+ `no fresh coins for ${coin.denomPubHash}`,
+ );
coinAv.freshCoinCount--;
await tx.coinAvailability.put(coinAv);
break;