taler-typescript-core

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

commit 067264294d292efb092520013d4da73f14bea77f
parent 880298110d53f7a053c8929e4627aac2dd346c94
Author: Florian Dold <dold@taler.net>
Date:   Mon, 20 Jul 2026 13:58:59 +0200

util: remove unnecessary short-circuiting of amount under-/overflows

The previous behavior can lead to "frozen" amounts once an underflow has
occurred.

Diffstat:
Mpackages/taler-util/src/amounts.ts | 9---------
1 file changed, 0 insertions(+), 9 deletions(-)

diff --git a/packages/taler-util/src/amounts.ts b/packages/taler-util/src/amounts.ts @@ -93,9 +93,6 @@ export class Amount { } add(...a: AmountLike[]): Amount { - if (this.saturated) { - return this; - } const r = Amounts.add(this.val, ...a); return new Amount(r.amount, r.saturated ? 1 : 0); } @@ -105,17 +102,11 @@ export class Amount { } sub(...a: AmountLike[]): Amount { - if (this.saturated) { - return this; - } const r = Amounts.sub(this.val, ...a); return new Amount(r.amount, r.saturated ? 1 : 0); } mult(n: number): Amount { - if (this.saturated) { - return this; - } const r = Amounts.mult(this, n); return new Amount(r.amount, r.saturated ? 1 : 0); }