Merge branch 'master' of github.com:bisq-network/bisq into redesign

This commit is contained in:
Christoph Atteneder 2018-10-16 19:45:50 +02:00
commit 95fa81361e
No known key found for this signature in database
GPG Key ID: CD5DC1C529CDFD3B
2 changed files with 9 additions and 3 deletions

View File

@ -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;
}

View File

@ -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