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.
This commit is contained in:
parent
d040c3b861
commit
a1c5f00aed
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user