From 05e52d4e116222728d9bcba3bcbf9e441bb4e4ed Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 6 Aug 2021 16:27:18 +0200 Subject: perf and logging improvements --- packages/taler-wallet-core/src/operations/exchanges.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'packages/taler-wallet-core/src/operations/exchanges.ts') diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts b/packages/taler-wallet-core/src/operations/exchanges.ts index 86a518671..64821a7b1 100644 --- a/packages/taler-wallet-core/src/operations/exchanges.ts +++ b/packages/taler-wallet-core/src/operations/exchanges.ts @@ -341,7 +341,6 @@ async function downloadKeysInfo( ); logger.info("received /keys response"); - logger.trace(j2s(exchangeKeysJson)); if (exchangeKeysJson.denoms.length === 0) { const opErr = makeErrorDetails( @@ -442,18 +441,23 @@ async function updateExchangeFromUrlImpl( const keysInfo = await downloadKeysInfo(baseUrl, ws.http, timeout); + logger.info("updating exchange /wire info"); const wireInfoDownload = await downloadExchangeWithWireInfo( baseUrl, ws.http, timeout, ); + logger.info("validating exchange /wire info"); + const wireInfo = await validateWireInfo( wireInfoDownload, keysInfo.masterPublicKey, ws.cryptoApi, ); + logger.info("finished validating exchange /wire info"); + const tosDownload = await downloadExchangeWithTermsOfService( baseUrl, ws.http, @@ -462,6 +466,8 @@ async function updateExchangeFromUrlImpl( let recoupGroupId: string | undefined = undefined; + logger.trace("updating exchange info in database"); + const updated = await ws.db .mktx((x) => ({ exchanges: x.exchanges, @@ -512,6 +518,7 @@ async function updateExchangeFromUrlImpl( await tx.exchanges.put(r); await tx.exchangeDetails.put(details); + logger.trace("updating denominations in database"); for (const currentDenom of keysInfo.currentDenominations) { const oldDenom = await tx.denominations.get([ baseUrl, @@ -523,6 +530,7 @@ async function updateExchangeFromUrlImpl( await tx.denominations.put(currentDenom); } } + logger.trace("done updating denominations in database"); // Handle recoup const recoupDenomList = keysInfo.recoup; @@ -579,6 +587,8 @@ async function updateExchangeFromUrlImpl( throw Error("something went wrong with updating the exchange"); } + logger.trace("done updating exchange info in database"); + return { exchange: updated.exchange, exchangeDetails: updated.exchangeDetails, -- cgit v1.2.3