mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Fix missing sorting
This commit is contained in:
parent
254059b411
commit
dabe6907e1
@ -99,6 +99,8 @@ public class ArbitratorSelection {
|
||||
.count();
|
||||
tuple.second.set(count);
|
||||
});
|
||||
|
||||
arbitratorTuples.sort(Comparator.comparing(e -> e.first));
|
||||
arbitratorTuples.sort(Comparator.comparingInt(e -> e.second.get()));
|
||||
return arbitratorTuples.get(0).first;
|
||||
}
|
||||
|
@ -30,9 +30,13 @@ public class ArbitratorSelectionTest {
|
||||
@Test
|
||||
public void testGetLeastUsedArbitrator() {
|
||||
// We get least used selected
|
||||
List<String> lastAddressesUsedInTrades = Arrays.asList("arb1", "arb2", "arb1");
|
||||
Set<String> arbitrators = new HashSet<>(Arrays.asList("arb1", "arb2"));
|
||||
String result = ArbitratorSelection.getLeastUsedArbitrator(lastAddressesUsedInTrades, arbitrators);
|
||||
List<String> lastAddressesUsedInTrades;
|
||||
Set<String> arbitrators;
|
||||
String result;
|
||||
|
||||
lastAddressesUsedInTrades = Arrays.asList("arb1", "arb2", "arb1");
|
||||
arbitrators = new HashSet<>(Arrays.asList("arb1", "arb2"));
|
||||
result = ArbitratorSelection.getLeastUsedArbitrator(lastAddressesUsedInTrades, arbitrators);
|
||||
assertEquals("arb2", result);
|
||||
|
||||
// if all are same we use first according to alphanumeric sorting
|
||||
|
Loading…
Reference in New Issue
Block a user