taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 3f19ec22a29b78ac904151005afd7708b72e1beb
parent 615af373158029b1308fc131358955e7de34f9ae
Author: Florian Dold <dold@taler.net>
Date:   Wed, 22 Jul 2026 15:40:47 +0200

wallet: let the exchange summary cache be consulted

The cache was cleared in the transaction immediately preceding the lookup, so
the lookup never hit, and the value it would have returned was a summary where
the caller expects the enclosing result and would have discarded it.

Dropping the caches is already handled after any transaction that writes an
exchange record, so the summary is only visible here while it is current.

Diffstat:
Mpackages/taler-wallet-core/src/exchanges.ts | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/packages/taler-wallet-core/src/exchanges.ts b/packages/taler-wallet-core/src/exchanges.ts @@ -1050,15 +1050,20 @@ export async function startUpdateExchangeEntry( } }); + // Writing an exchange record marks the transaction as cache-invalidating, + // so the caches are dropped after it commits and this lookup sees a summary + // only while it is still current. await wex.runWalletDbTx(async (tx) => { - wex.ws.exchangeCache.clear(); return provideExchangeRecordInTx(wex.ws, tx, exchangeBaseUrl); }); if (!options.forceUpdate) { - const cachedResp = wex.ws.exchangeCache.get(exchangeBaseUrl); - if (cachedResp) { - return cachedResp; + const cachedSummary = wex.ws.exchangeCache.get(exchangeBaseUrl); + if (cachedSummary) { + return { + exchangeBaseUrl: cachedSummary.exchangeBaseUrl, + readySummary: cachedSummary, + }; } } else { wex.ws.exchangeCache.clear();