From bafb52edff4d56bcb9e3c3d0a260f507c517b08c Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 16 Dec 2020 17:59:04 +0100 Subject: don't store reserve history anymore, adjust withdrawal implementation accordingly --- packages/taler-wallet-core/src/operations/tip.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 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 bc10e346d..f47f76623 100644 --- a/packages/taler-wallet-core/src/operations/tip.ts +++ b/packages/taler-wallet-core/src/operations/tip.ts @@ -32,8 +32,10 @@ import { } from "../types/dbTypes"; import { getExchangeWithdrawalInfo, - selectWithdrawalDenoms, denomSelectionInfoToState, + updateWithdrawalDenoms, + getPossibleWithdrawalDenoms, + selectWithdrawalDenominations, } from "./withdraw"; import { updateExchangeFromUrl } from "./exchanges"; import { getRandomBytes, encodeCrock } from "../crypto/talerCrypto"; @@ -92,12 +94,15 @@ export async function prepareTip( ); const walletTipId = encodeCrock(getRandomBytes(32)); - const selectedDenoms = await selectWithdrawalDenoms( - ws, - tipPickupStatus.exchange_url, + await updateWithdrawalDenoms(ws, tipPickupStatus.exchange_url); + const denoms = await getPossibleWithdrawalDenoms(ws, tipPickupStatus.exchange_url); + const selectedDenoms = await selectWithdrawalDenominations( amount, + denoms ); + const secretSeed = encodeCrock(getRandomBytes(64)); + tipRecord = { walletTipId: walletTipId, acceptedTimestamp: undefined, @@ -105,7 +110,6 @@ export async function prepareTip( tipExpiration: tipPickupStatus.expiration, exchangeBaseUrl: tipPickupStatus.exchange_url, merchantBaseUrl: res.merchantBaseUrl, - planchets: undefined, createdTimestamp: getTimestampNow(), merchantTipId: res.merchantTipId, tipAmountEffective: Amounts.sub( @@ -117,6 +121,7 @@ export async function prepareTip( lastError: undefined, denomsSel: denomSelectionInfoToState(selectedDenoms), pickedUpTimestamp: undefined, + secretSeed, }; await ws.db.put(Stores.tips, tipRecord); } @@ -316,6 +321,7 @@ async function processTipImpl( exchangeBaseUrl: tipRecord.exchangeBaseUrl, status: CoinStatus.Fresh, suspended: false, + coinEvHash: planchet.coinEvHash, }); } -- cgit v1.2.3