commit 2bf716d4db6b5aa4f41e1f81fc34c1f30e654a28
parent 416c6e7d2a4760297c8de4a8afc6d06f569bc463
Author: Florian Dold <florian@dold.me>
Date: Wed, 18 Mar 2026 21:38:40 +0100
wallet-core: never succeed in denom selection when exchange offers no denoms
In some cases (such as very small amounts), denomination selection
results in the selection of zero denominations.
However, when the exchange doesn't offer *any* denominations, it's an
indication to the wallet that the exchange is outdated and needs to be
fixed by its operator.
In this case, wallet-core will not proceed with an empty denom selection
but instead the affected transaction will be in an error state.
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/packages/taler-wallet-core/src/denomSelection.ts b/packages/taler-wallet-core/src/denomSelection.ts
@@ -77,6 +77,12 @@ export function selectWithdrawalDenominations(
denoms: DenominationRecord[],
opts: { limitCoins?: number } = {},
): DenomSelectionState {
+ if (denoms.length == 0) {
+ // This is a protocol violation.
+ // We won't proceed.
+ throw Error("no withdrawal denominations available");
+ }
+
let remaining = Amounts.copy(amountAvailable);
const selectedDenoms: {