commit 85c04aa4515b3d09601f7dcabb2c0211b6ebd637
parent 7115e363e18b91ed1f3fdeb96c69a5cf3fab2953
Author: Florian Dold <florian@dold.me>
Date: Sat, 14 Feb 2026 01:25:19 +0100
wallet-core: use fetchFreshExchange
Diffstat:
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/packages/taler-wallet-core/src/exchanges.ts b/packages/taler-wallet-core/src/exchanges.ts
@@ -1266,19 +1266,26 @@ export interface ReadyExchangeSummary {
* Ensure that a fresh exchange entry exists for the given
* exchange base URL.
*
- *
* If an exchange entry for the database doesn't exist in the
* DB, it will be added ephemerally.
*
* If the expectedMasterPub is given and does not match the actual
* master pub, an exception will be thrown. However, the exchange
* will still have been added as an ephemeral exchange entry.
+ *
+ * If options.noBail is set, do not stop waiting when
+ * the exchange is in an unavailable or error state.
+ *
+ * If options.forceUpdate is set, only return when
+ * the exchange is really not updating anymore,
+ * even when the exchange entry still looks recent enough.
*/
export async function fetchFreshExchange(
wex: WalletExecutionContext,
baseUrl: string,
options: {
forceUpdate?: boolean;
+ noBail?: boolean;
} = {},
): Promise<ReadyExchangeSummary> {
logger.trace(`fetch fresh ${baseUrl} forced ${options.forceUpdate}`);
@@ -1326,7 +1333,7 @@ export async function fetchFreshExchange(
* the exchange is really not updating anymore,
* even when the exchange entry still looks recent enough.
*/
-export async function waitReadyExchange(
+async function waitReadyExchange(
wex: WalletExecutionContext,
exchangeBaseUrl: string,
options: {
diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts
@@ -179,7 +179,6 @@ import {
lookupExchangeByUri,
markExchangeUsed,
startUpdateExchangeEntry,
- waitReadyExchange,
} from "./exchanges.js";
import {
GenericKycStatusReq,
@@ -1069,7 +1068,7 @@ async function processWithdrawalGroupRedenominate(
if (!exchangeBaseUrl) {
throw Error("invalid state (no exchange base URL)");
}
- await waitReadyExchange(wex, exchangeBaseUrl, {
+ await fetchFreshExchange(wex, exchangeBaseUrl, {
noBail: true,
});
await redenominateWithdrawal(