taler-typescript-core

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

commit 218ca3a7893a38d61896cd1894a75f4e04887379
parent 0d555b6a5ddb95309bfef1a2884bde405fb6e59a
Author: Florian Dold <dold@taler.net>
Date:   Wed, 22 Jul 2026 10:48:15 +0200

wallet: fail when deposit fees exceed the deposited value

The saturating subtraction turned that case into a counterparty amount of
zero, which was then stored on the deposit group and shown as the raw amount.

Diffstat:
Mpackages/taler-wallet-core/src/deposits.ts | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/packages/taler-wallet-core/src/deposits.ts b/packages/taler-wallet-core/src/deposits.ts @@ -2411,7 +2411,13 @@ async function getCounterpartyEffectiveDepositAmount( } } }); - return Amounts.sub(Amounts.sum(amt).amount, Amounts.sum(fees).amount).amount; + const res = Amounts.sub(Amounts.sum(amt).amount, Amounts.sum(fees).amount); + if (res.saturated) { + throw Error( + "can't calculate deposit amount, the fees exceed the deposited value", + ); + } + return res.amount; } /**