Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account Signing: Improve arbitrator signing flow #3421

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -54,8 +54,12 @@
import javafx.util.Callback;
import javafx.util.StringConverter;

import java.time.Instant;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.temporal.ChronoUnit;

import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -124,6 +128,7 @@ public PaymentMethod fromString(String s) {

List<PaymentMethod> list = PaymentMethod.getPaymentMethods().stream()
.filter(paymentMethod -> !paymentMethod.isAsset())
.filter(PaymentMethod::hasChargebackRisk)
.collect(Collectors.toList());

paymentMethodComboBox.setItems(FXCollections.observableArrayList(list));
Expand All @@ -133,6 +138,8 @@ public PaymentMethod fromString(String s) {
Res.get("popup.accountSigning.selectAccounts.datePicker"),
0).second;
datePicker.setOnAction(e -> updateAccountSelectionState());
datePicker.setValue(Instant.ofEpochMilli(new Date().getTime()).minus(60, ChronoUnit.DAYS)
.atZone(ZoneId.systemDefault()).toLocalDate());
}

private void addECKeyField() {
Expand Down Expand Up @@ -207,13 +214,15 @@ private void addAccountsToSignContent() {
String arbitratorPubKeyAsHex = Utils.HEX.encode(arbitratorKey.getPubKey());
boolean isKeyValid = arbitratorManager.isPublicKeyInList(arbitratorPubKeyAsHex);
if (isKeyValid) {
selectedPaymentAccountsList.getItems().forEach(item -> {
accountAgeWitnessService.arbitratorSignAccountAgeWitness(item.getTradeAmount(), item.getAccountAgeWitness(), arbitratorKey, item.getPeersPubKey());
});
selectedPaymentAccountsList.getItems().forEach(item ->
accountAgeWitnessService.arbitratorSignAccountAgeWitness(item.getTradeAmount(),
item.getAccountAgeWitness(),
arbitratorKey,
item.getPeersPubKey()));
addSuccessContent();
}
} else {
new Popup<>().error(Res.get("popup.accountSigning.signAccounts.ECKey.error")).onClose(() -> hide()).show();
new Popup<>().error(Res.get("popup.accountSigning.signAccounts.ECKey.error")).onClose(this::hide).show();
}

});
Expand All @@ -229,9 +238,7 @@ private void addSuccessContent() {
headLineLabel.setText(Res.get("popup.accountSigning.success.headline"));
descriptionLabel.setText(Res.get("popup.accountSigning.success.description", selectedPaymentAccountsList.getItems().size()));
((AutoTooltipButton) actionButton).updateText(Res.get("shared.ok"));
actionButton.setOnAction(a -> {
hide();
});
actionButton.setOnAction(a -> hide());
}

@Override
Expand Down