Fix nullpointer, fix wrong hash at arb. select.

This commit is contained in:
Manfred Karrer 2016-01-21 13:03:38 +01:00
parent 840a233544
commit ceae998bee
2 changed files with 3 additions and 2 deletions

View File

@ -24,6 +24,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@ -39,7 +40,7 @@ public class ArbitrationSelectionRule {
}
checkArgument(candidates.size() > 0, "candidates.size() <= 0");
int index = Math.abs(Sha256Hash.hash(offer.getId().getBytes()).hashCode()) % candidates.size();
int index = Math.abs(Arrays.hashCode(Sha256Hash.hash(offer.getId().getBytes()))) % candidates.size();
NodeAddress selectedArbitrator = candidates.get(index);
log.debug("selectedArbitrator " + selectedArbitrator);
return selectedArbitrator;

View File

@ -101,7 +101,6 @@ public class EmptyWalletPopup extends Popup {
emptyWalletButton = new Button("Empty wallet");
boolean isBalanceSufficient = Restrictions.isAboveDust(totalBalance);
emptyWalletButton.setDefaultButton(isBalanceSufficient);
closeButton.setDefaultButton(!isBalanceSufficient);
emptyWalletButton.setDisable(!isBalanceSufficient && addressInputTextField.getText().length() > 0);
emptyWalletButton.setOnAction(e -> {
if (addressInputTextField.getText().length() > 0 && isBalanceSufficient) {
@ -121,6 +120,7 @@ public class EmptyWalletPopup extends Popup {
hide();
closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run());
});
closeButton.setDefaultButton(!isBalanceSufficient);
HBox hBox = new HBox();
hBox.setSpacing(10);