invalidate multisig addresses for message signing and include address tooltip for guidance

This commit is contained in:
Craig Raw 2022-08-02 11:21:00 +02:00
parent 7e91f57a42
commit cc8dd59dbc

View file

@ -128,6 +128,7 @@ public class MessageSignDialog extends Dialog<ButtonBar.ButtonData> {
address = new TextField(); address = new TextField();
address.getStyleClass().add("id"); address.getStyleClass().add("id");
address.setEditable(walletNode == null); address.setEditable(walletNode == null);
address.setTooltip(new Tooltip("Only Legacy (P2PKH), Nested Segwit (P2SH-P2WPKH) and Native Segwit (P2WPKH) singlesig addresses can sign"));
addressField.getInputs().add(address); addressField.getInputs().add(address);
if(walletNode != null) { if(walletNode != null) {
@ -294,7 +295,7 @@ public class MessageSignDialog extends Dialog<ButtonBar.ButtonData> {
private boolean isValidAddress() { private boolean isValidAddress() {
try { try {
Address address = getAddress(); Address address = getAddress();
return address.getScriptType() != ScriptType.P2TR; return address.getScriptType() != ScriptType.P2TR && address.getScriptType().isAllowed(PolicyType.SINGLE);
} catch (InvalidAddressException e) { } catch (InvalidAddressException e) {
return false; return false;
} }
@ -371,15 +372,9 @@ public class MessageSignDialog extends Dialog<ButtonBar.ButtonData> {
} }
if(verified) { if(verified) {
Alert alert = new Alert(Alert.AlertType.INFORMATION); AppServices.showSuccessDialog("Verification Succeeded", "The signature verified against the message.");
AppServices.setStageIcon(alert.getDialogPane().getScene().getWindow());
alert.setTitle("Verification Succeeded");
alert.setHeaderText("Verification Succeeded");
alert.setContentText("The signature verified against the message.");
AppServices.moveToActiveWindowScreen(alert);
alert.showAndWait();
} else { } else {
AppServices.showErrorDialog("Verification failed", "The provided signature did not match the message for this address."); AppServices.showErrorDialog("Verification Failed", "The provided signature did not match the message for this address.");
} }
} catch(IllegalArgumentException e) { } catch(IllegalArgumentException e) {
AppServices.showErrorDialog("Could not verify message", e.getMessage()); AppServices.showErrorDialog("Could not verify message", e.getMessage());