[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] 02/02: wallet: fix p2p coin selection
From: |
gnunet |
Subject: |
[taler-wallet-core] 02/02: wallet: fix p2p coin selection |
Date: |
Tue, 06 Dec 2022 19:45:10 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
commit a1c5f00aedb75e5e2deb6b12c3cfb06eefb355e4
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Dec 6 19:41:32 2022 +0100
wallet: fix p2p coin selection
The p2p coin selection didn't work properly when all available denoms
are needed.
Thanks to Florian Jung for finding the issue and suggesting a fix.
---
packages/taler-wallet-core/src/operations/pay-peer.ts | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/packages/taler-wallet-core/src/operations/pay-peer.ts
b/packages/taler-wallet-core/src/operations/pay-peer.ts
index f31a7f37c..cc859f243 100644
--- a/packages/taler-wallet-core/src/operations/pay-peer.ts
+++ b/packages/taler-wallet-core/src/operations/pay-peer.ts
@@ -191,12 +191,7 @@ export async function selectPeerCoins(
}[] = [];
for (const coin of coinInfos) {
if (Amounts.cmp(amountAcc, instructedAmount) >= 0) {
- const res: PeerCoinSelection = {
- exchangeBaseUrl: exch.baseUrl,
- coins: resCoins,
- depositFees: depositFeesAcc,
- };
- return res;
+ break;
}
const gap = Amounts.add(
coin.feeDeposit,
@@ -217,6 +212,14 @@ export async function selectPeerCoins(
ageCommitmentProof: coin.ageCommitmentProof,
});
}
+ if (Amounts.cmp(amountAcc, instructedAmount) >= 0) {
+ const res: PeerCoinSelection = {
+ exchangeBaseUrl: exch.baseUrl,
+ coins: resCoins,
+ depositFees: depositFeesAcc,
+ };
+ return res;
+ }
continue;
}
return undefined;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.