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) {
|
for (const coin of coinInfos) {
|
||||||
if (Amounts.cmp(amountAcc, instructedAmount) >= 0) {
|
if (Amounts.cmp(amountAcc, instructedAmount) >= 0) {
|
||||||
const res: PeerCoinSelection = {
|
break;
|
||||||
exchangeBaseUrl: exch.baseUrl,
|
|
||||||
coins: resCoins,
|
|
||||||
depositFees: depositFeesAcc,
|
|
||||||
};
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
const gap = Amounts.add(
|
const gap = Amounts.add(
|
||||||
coin.feeDeposit,
|
coin.feeDeposit,
|
||||||
@ -217,6 +212,14 @@ export async function selectPeerCoins(
|
|||||||
ageCommitmentProof: coin.ageCommitmentProof,
|
ageCommitmentProof: coin.ageCommitmentProof,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (Amounts.cmp(amountAcc, instructedAmount) >= 0) {
|
||||||
|
const res: PeerCoinSelection = {
|
||||||
|
exchangeBaseUrl: exch.baseUrl,
|
||||||
|
coins: resCoins,
|
||||||
|
depositFees: depositFeesAcc,
|
||||||
|
};
|
||||||
|
return res;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
|
Loading…
Reference in New Issue
Block a user