diff options
-rw-r--r-- | packages/taler-wallet-core/src/operations/pay-peer.ts | 15 |
1 files 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; |