Browse Source

add config option to disable script type derivation validation

terminal
Craig Raw 4 years ago
parent
commit
62d83151d7
  1. 2
      drongo
  2. 3
      src/main/java/com/sparrowwallet/sparrow/MainApp.java
  3. 10
      src/main/java/com/sparrowwallet/sparrow/io/Config.java
  4. 10
      src/main/java/com/sparrowwallet/sparrow/preferences/GeneralPreferencesController.java
  5. 6
      src/main/resources/com/sparrowwallet/sparrow/preferences/general.fxml

2
drongo

@ -1 +1 @@
Subproject commit 79216fac912724e7b06b3ffe15e38ddf005e665f
Subproject commit fe91063e8fa5acb967907c6e1f65b21e7bca0375

3
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) {

10
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;
}

10
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> 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) -> {

6
src/main/resources/com/sparrowwallet/sparrow/preferences/general.fxml

@ -71,6 +71,12 @@
</ComboBox>
</Field>
</Fieldset>
<Fieldset inputGrow="SOMETIMES" text="Wallet" styleClass="wideLabelFieldSet">
<Field text="Validate derivations:">
<UnlabeledToggleSwitch fx:id="validateDerivationPaths" />
<HelpLabel helpText="Disallow keystores to have derivation paths that match the defaults for other script types."/>
</Field>
</Fieldset>
<Fieldset inputGrow="SOMETIMES" text="Coin Selection" styleClass="wideLabelFieldSet">
<Field text="Group by address:">
<UnlabeledToggleSwitch fx:id="groupByAddress" />

Loading…
Cancel
Save