commit ea9a92a7954f2fbfcdd38234609369d36d01f9d7
parent eda95a23f1407ab0d11864aa1232f1422211dc35
Author: Florian Dold <dold@taler.net>
Date: Wed, 22 Jul 2026 00:34:07 +0200
wallet: skip zero-valued donation units
A unit worth nothing never reduced the remaining amount and the loop only
advances when a candidate does not fit, so such a unit was appended to
the selection forever.
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/packages/taler-wallet-core/src/donau.ts b/packages/taler-wallet-core/src/donau.ts
@@ -460,6 +460,11 @@ export async function generateDonauPlanchets(
break;
}
const cand = candidates[i];
+ if (Amounts.isZero(cand.value)) {
+ // Would never reduce the remaining amount.
+ i++;
+ continue;
+ }
if (Amounts.cmp(remaining, cand.value) >= 0) {
selection.push(cand);
remaining = remaining.sub(cand.value);