[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: don't rip off the merchant vi
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: don't rip off the merchant via our coin selection |
Date: |
Fri, 27 Mar 2020 10:50:26 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new 1c747ae0 don't rip off the merchant via our coin selection
1c747ae0 is described below
commit 1c747ae004fcaa947a62cd23b77857161f7ff03e
Author: Florian Dold <address@hidden>
AuthorDate: Fri Mar 27 15:20:02 2020 +0530
don't rip off the merchant via our coin selection
---
src/operations/pay.ts | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/operations/pay.ts b/src/operations/pay.ts
index 9a8017e4..f3468ae4 100644
--- a/src/operations/pay.ts
+++ b/src/operations/pay.ts
@@ -234,11 +234,17 @@ export function selectPayCoins(
).amount;
if (Amounts.cmp(amountActualAvailable, amountPayRemaining) > 0) {
- // Partial spending
+ // Partial spending, as the coin is worth more than the remaining
+ // amount to pay.
coinSpend = Amounts.add(amountPayRemaining, depositFeeSpend).amount;
+ // Make sure we contribute at least the deposit fee, otherwise
+ // contributing this coin would cause a loss for the merchant.
+ if (Amounts.cmp(coinSpend, aci.feeDeposit) < 0) {
+ coinSpend = aci.feeDeposit;
+ }
amountPayRemaining = Amounts.getZero(currency);
} else {
- // Spend the full remaining amount
+ // Spend the full remaining amount on the coin
coinSpend = aci.availableAmount;
amountPayRemaining = Amounts.add(amountPayRemaining, depositFeeSpend)
.amount;
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: don't rip off the merchant via our coin selection,
gnunet <=