From 84d5b5e5ef34f7289256c6fd301206cda19be694 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 17 Dec 2020 12:21:03 +0100 Subject: export complete backup, derive planchets in withdrawal --- packages/taler-wallet-core/src/operations/tip.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'packages/taler-wallet-core/src/operations/tip.ts') diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts index f47f76623..f683999bc 100644 --- a/packages/taler-wallet-core/src/operations/tip.ts +++ b/packages/taler-wallet-core/src/operations/tip.ts @@ -48,7 +48,7 @@ import { } from "../util/http"; import { URL } from "../util/url"; import { Logger } from "../util/logging"; -import { checkDbInvariant } from "../util/invariants"; +import { checkDbInvariant, checkLogicInvariant } from "../util/invariants"; import { TalerErrorCode } from "../TalerErrorCode"; import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries"; import { j2s } from "../util/helpers"; @@ -221,13 +221,13 @@ async function processTipImpl( dh.denomPubHash, ]); checkDbInvariant(!!denom, "denomination should be in database"); - denomForPlanchet[planchets.length] = denom; for (let i = 0; i < dh.count; i++) { const p = await ws.cryptoApi.createTipPlanchet({ - denomPub: dh.denomPubHash, + denomPub: denom.denomPub, planchetIndex: planchets.length, secretSeed: tipRecord.secretSeed, }); + denomForPlanchet[planchets.length] = denom; planchets.push(p); planchetsDetail.push({ coin_ev: p.coinEv, @@ -275,7 +275,9 @@ async function processTipImpl( const blindedSig = response.blind_sigs[i].blind_sig; const denom = denomForPlanchet[i]; + checkLogicInvariant(!!denom); const planchet = planchets[i]; + checkLogicInvariant(!!planchet); const denomSig = await ws.cryptoApi.rsaUnblind( blindedSig, -- cgit v1.2.3