From 1ed59bb9359b6fae59c1a6db9cc09faddef9fc87 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 18 May 2020 17:19:43 +0200 Subject: [PATCH] no fingerprint labels and tests --- drongo | 2 +- .../sparrow/control/KeystorePassphraseDialog.java | 8 ++++---- .../com/sparrowwallet/sparrow/io/ColdcardMultisig.java | 5 +++-- .../com/sparrowwallet/sparrow/io/ColdcardSinglesig.java | 2 +- src/main/java/com/sparrowwallet/sparrow/io/Electrum.java | 2 +- .../sparrowwallet/sparrow/wallet/KeystoreController.java | 1 + 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drongo b/drongo index 8ffd2250..aa60e6b9 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit 8ffd22500754b77e420e2a3f887864e89a47e906 +Subproject commit aa60e6b92e0401a27c3760cc9cb7e726a2caa845 diff --git a/src/main/java/com/sparrowwallet/sparrow/control/KeystorePassphraseDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/KeystorePassphraseDialog.java index 9cf066ff..43ba9558 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/KeystorePassphraseDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/KeystorePassphraseDialog.java @@ -19,15 +19,15 @@ public class KeystorePassphraseDialog extends Dialog { final DialogPane dialogPane = getDialogPane(); setTitle("Keystore Passphrase"); - dialogPane.setHeaderText("Please enter the passphrase for keystore: " + keystore.getLabel()); + dialogPane.setHeaderText("Please enter the passphrase for keystore: \n" + keystore.getLabel()); dialogPane.getStylesheets().add(AppController.class.getResource("general.css").toExternalForm()); dialogPane.getButtonTypes().addAll(ButtonType.CANCEL, ButtonType.OK); dialogPane.setPrefWidth(380); dialogPane.setPrefHeight(200); - Glyph lock = new Glyph("FontAwesome5", FontAwesome5.Glyph.KEY); - lock.setFontSize(50); - dialogPane.setGraphic(lock); + Glyph key = new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.KEY); + key.setFontSize(50); + dialogPane.setGraphic(key); final VBox content = new VBox(10); content.setPrefHeight(50); diff --git a/src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java b/src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java index 0091b3e8..4bb1ea53 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java @@ -36,7 +36,7 @@ public class ColdcardMultisig implements WalletImport, KeystoreFileImport, Walle InputStreamReader reader = new InputStreamReader(inputStream); ColdcardKeystore cck = Storage.getGson().fromJson(reader, ColdcardKeystore.class); - Keystore keystore = new Keystore("Coldcard " + cck.xfp); + Keystore keystore = new Keystore("Coldcard"); keystore.setSource(KeystoreSource.HW_AIRGAPPED); keystore.setWalletModel(WalletModel.COLDCARD); @@ -109,11 +109,12 @@ public class ColdcardMultisig implements WalletImport, KeystoreFileImport, Walle break; default: if (key.length() == 8 && Utils.isHex(key)) { - Keystore keystore = new Keystore("Coldcard " + key); + Keystore keystore = new Keystore("Coldcard"); keystore.setSource(KeystoreSource.HW_AIRGAPPED); keystore.setWalletModel(WalletModel.COLDCARD); keystore.setKeyDerivation(new KeyDerivation(key, derivation)); keystore.setExtendedPublicKey(ExtendedKey.fromDescriptor(value)); + wallet.makeLabelsUnique(keystore); wallet.getKeystores().add(keystore); } } diff --git a/src/main/java/com/sparrowwallet/sparrow/io/ColdcardSinglesig.java b/src/main/java/com/sparrowwallet/sparrow/io/ColdcardSinglesig.java index 846ffa9f..e7f0f092 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/ColdcardSinglesig.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/ColdcardSinglesig.java @@ -59,7 +59,7 @@ public class ColdcardSinglesig implements KeystoreFileImport { ScriptType ckScriptType = ScriptType.valueOf(ck.name.replace("p2wpkh-p2sh", "p2sh_p2wpkh").toUpperCase()); if(ckScriptType.equals(scriptType)) { Keystore keystore = new Keystore(); - keystore.setLabel("Coldcard " + masterFingerprint.toUpperCase()); + keystore.setLabel("Coldcard"); keystore.setSource(KeystoreSource.HW_AIRGAPPED); keystore.setWalletModel(WalletModel.COLDCARD); keystore.setKeyDerivation(new KeyDerivation(masterFingerprint, ck.deriv)); diff --git a/src/main/java/com/sparrowwallet/sparrow/io/Electrum.java b/src/main/java/com/sparrowwallet/sparrow/io/Electrum.java index cb763a94..891890c5 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/Electrum.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/Electrum.java @@ -131,7 +131,7 @@ public class Electrum implements KeystoreFileImport, WalletImport, WalletExport keystore.setKeyDerivation(new KeyDerivation(masterFingerprint, derivationPath)); keystore.setExtendedPublicKey(xPub); - keystore.setLabel(ek.label != null ? ek.label : "Electrum " + masterFingerprint); + keystore.setLabel(ek.label != null ? ek.label : "Electrum"); wallet.getKeystores().add(keystore); ExtendedKey.Header xpubHeader = ExtendedKey.Header.fromExtendedKey(ek.xpub); diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java index 1143ea5b..f7d5fdf8 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java @@ -182,6 +182,7 @@ public class KeystoreController extends WalletFormController implements Initiali selectSourcePane.setVisible(false); Keystore importedKeystore = result.get(); + walletForm.getWallet().makeLabelsUnique(importedKeystore); keystore.setSource(importedKeystore.getSource()); keystore.setWalletModel(importedKeystore.getWalletModel()); keystore.setLabel(importedKeystore.getLabel());