From 1887e1c7b0ae3df3982af390ebdba0b87be6daf3 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 22 Apr 2024 13:29:41 +0200 Subject: [PATCH] allow editing of the output descriptor of a new account on a watch only wallet --- .../sparrowwallet/sparrow/wallet/SettingsController.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java index b8064997..28651c94 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java @@ -464,6 +464,11 @@ private void setDescriptorText(String text) { } private void rederiveAndReplaceWallet(Wallet editedWallet) { + if(!walletForm.getWallet().isMasterWallet() && (editedWallet.getPolicyType() != walletForm.getMasterWallet().getPolicyType() || editedWallet.getScriptType() != walletForm.getMasterWallet().getScriptType())) { + AppServices.showErrorDialog("Policy or Script Type Mismatch", "The provided output descriptor does not match the policy or script type of this wallet."); + return; + } + boolean rederive = false; for(Keystore keystore : editedWallet.getKeystores()) { Optional optExisting = walletForm.getWallet().getKeystores().stream() @@ -769,7 +774,7 @@ private void setInputFieldsDisabled(boolean disabled) { policyType.setDisable(disabled); scriptType.setDisable(disabled); multisigControl.setDisable(disabled); - editDescriptor.setVisible(!disabled); + editDescriptor.setVisible(!disabled || (!walletForm.getWallet().isValid() && walletForm.getMasterWallet().getKeystores().stream().allMatch(k -> k.getSource() == KeystoreSource.SW_WATCH))); } @Override