taler-typescript-core

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

commit 6aa3639b9817f25906957c62490c931c1de2989c
parent f7e1c77bb45ecb98f4008bdbe508e8d4a8b545b7
Author: Florian Dold <dold@taler.net>
Date:   Wed, 22 Jul 2026 11:04:06 +0200

wallet: skip unspendable coins in the maximum push debit amount

The peer coin selection goes through selectGreedy as well, which refuses
coins whose deposit fee exceeds their value.

Diffstat:
Mpackages/taler-wallet-core/src/coinSelection.ts | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/packages/taler-wallet-core/src/coinSelection.ts b/packages/taler-wallet-core/src/coinSelection.ts @@ -1539,6 +1539,13 @@ function getMaxPeerPushDebitAmountForAvailableCoins( let fees = Amounts.zeroOfCurrency(req.currency); for (const cc of candidateRes.coinAvailability) { + // Same rule as selectGreedy, which the peer coin selection also goes + // through: a coin that costs more to deposit than it is worth is never + // selected, so counting it would promise an amount that can't be reached. + if (Amounts.cmp(cc.feeDeposit, cc.value) > 0) { + continue; + } + amountEffective = Amounts.add( amountEffective, Amounts.mult(cc.value, cc.numAvailable).amount,