diff --git a/drongo b/drongo index 79216fac..fe91063e 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit 79216fac912724e7b06b3ffe15e38ddf005e665f +Subproject commit fe91063e8fa5acb967907c6e1f65b21e7bca0375 diff --git a/src/main/java/com/sparrowwallet/sparrow/MainApp.java b/src/main/java/com/sparrowwallet/sparrow/MainApp.java index 0551f416..0c239e1c 100644 --- a/src/main/java/com/sparrowwallet/sparrow/MainApp.java +++ b/src/main/java/com/sparrowwallet/sparrow/MainApp.java @@ -2,6 +2,7 @@ package com.sparrowwallet.sparrow; import com.beust.jcommander.JCommander; import com.sparrowwallet.drongo.Network; +import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.sparrow.control.WelcomeDialog; import com.sparrowwallet.sparrow.glyphfont.FontAwesome5; import com.sparrowwallet.sparrow.glyphfont.FontAwesome5Brands; @@ -73,6 +74,8 @@ public class MainApp extends Application { Config.get().setCoreWallet(""); } + System.setProperty(Wallet.ALLOW_DERIVATIONS_MATCHING_OTHER_SCRIPT_TYPES_PROPERTY, Boolean.toString(!Config.get().isValidateDerivationPaths())); + AppController appController = AppServices.newAppWindow(stage); if(createNewWallet) { diff --git a/src/main/java/com/sparrowwallet/sparrow/io/Config.java b/src/main/java/com/sparrowwallet/sparrow/io/Config.java index 398b798c..cf89556f 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/Config.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/Config.java @@ -25,6 +25,7 @@ public class Config { private FeeRatesSelection feeRatesSelection; private Currency fiatCurrency; private ExchangeSource exchangeSource; + private boolean validateDerivationPaths = true; private boolean groupByAddress = true; private boolean includeMempoolChange = true; private boolean notifyNewTransactions = true; @@ -154,6 +155,15 @@ public class Config { flush(); } + public boolean isValidateDerivationPaths() { + return validateDerivationPaths; + } + + public void setValidateDerivationPaths(boolean validateDerivationPaths) { + this.validateDerivationPaths = validateDerivationPaths; + flush(); + } + public boolean isGroupByAddress() { return groupByAddress; } diff --git a/src/main/java/com/sparrowwallet/sparrow/preferences/GeneralPreferencesController.java b/src/main/java/com/sparrowwallet/sparrow/preferences/GeneralPreferencesController.java index cb14a16a..ee5975ec 100644 --- a/src/main/java/com/sparrowwallet/sparrow/preferences/GeneralPreferencesController.java +++ b/src/main/java/com/sparrowwallet/sparrow/preferences/GeneralPreferencesController.java @@ -1,6 +1,7 @@ package com.sparrowwallet.sparrow.preferences; import com.sparrowwallet.drongo.BitcoinUnit; +import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.sparrow.EventManager; import com.sparrowwallet.sparrow.control.UnlabeledToggleSwitch; import com.sparrowwallet.sparrow.event.*; @@ -32,6 +33,9 @@ public class GeneralPreferencesController extends PreferencesDetailController { @FXML private ComboBox exchangeSource; + @FXML + private UnlabeledToggleSwitch validateDerivationPaths; + @FXML private UnlabeledToggleSwitch groupByAddress; @@ -93,6 +97,12 @@ public class GeneralPreferencesController extends PreferencesDetailController { updateCurrencies(exchangeSource.getSelectionModel().getSelectedItem()); + validateDerivationPaths.setSelected(config.isValidateDerivationPaths()); + validateDerivationPaths.selectedProperty().addListener((observableValue, oldValue, newValue) -> { + config.setValidateDerivationPaths(newValue); + System.setProperty(Wallet.ALLOW_DERIVATIONS_MATCHING_OTHER_SCRIPT_TYPES_PROPERTY, Boolean.toString(!newValue)); + }); + groupByAddress.setSelected(config.isGroupByAddress()); includeMempoolChange.setSelected(config.isIncludeMempoolChange()); groupByAddress.selectedProperty().addListener((observableValue, oldValue, newValue) -> { diff --git a/src/main/resources/com/sparrowwallet/sparrow/preferences/general.fxml b/src/main/resources/com/sparrowwallet/sparrow/preferences/general.fxml index 40a8afce..6a8906b6 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/preferences/general.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/preferences/general.fxml @@ -71,6 +71,12 @@ +
+ + + + +