sort coins by amount first
This commit is contained in:
parent
e124e05d53
commit
a76219b8de
@ -185,10 +185,12 @@ export function selectPayCoins(
|
|||||||
}
|
}
|
||||||
const coinPubs: string[] = [];
|
const coinPubs: string[] = [];
|
||||||
const coinContributions: AmountJson[] = [];
|
const coinContributions: AmountJson[] = [];
|
||||||
// Sort by ascending deposit fee and denomPub if deposit fee is the same
|
// Sort by available amount (descending), deposit fee (ascending) and
|
||||||
|
// denomPub (ascending) if deposit fee is the same
|
||||||
// (to guarantee deterministic results)
|
// (to guarantee deterministic results)
|
||||||
acis.sort(
|
acis.sort(
|
||||||
(o1, o2) =>
|
(o1, o2) =>
|
||||||
|
-Amounts.cmp(o1.availableAmount, o2.availableAmount) ||
|
||||||
Amounts.cmp(o1.feeDeposit, o2.feeDeposit) ||
|
Amounts.cmp(o1.feeDeposit, o2.feeDeposit) ||
|
||||||
strcmp(o1.denomPub, o2.denomPub),
|
strcmp(o1.denomPub, o2.denomPub),
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user