mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2026-08-11 09:08:02 +00:00
update to support bip375
This commit is contained in:
@@ -1911,7 +1911,7 @@ public class AppController implements Initializable {
|
||||
}
|
||||
|
||||
private void addTransactionTab(String name, File file, PSBT psbt) {
|
||||
//Convert to PSBTv0 first
|
||||
//Convert to PSBTv0 first as the consistent internal representation
|
||||
if(psbt.getVersion() != null && psbt.getVersion() >= 2) {
|
||||
psbt.convertVersion(0);
|
||||
}
|
||||
|
||||
@@ -656,7 +656,7 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
|
||||
|
||||
List<ChildNumber> path = cryptoKeypath.getComponents().stream().map(comp -> (IndexPathComponent)comp)
|
||||
.map(comp -> new ChildNumber(comp.getIndex(), comp.isHardened())).collect(Collectors.toList());
|
||||
String fingerprint = cryptoKeypath.getSourceFingerprint() == null ? KeystoreController.DEFAULT_WATCH_ONLY_FINGERPRINT : Utils.bytesToHex(cryptoKeypath.getSourceFingerprint());
|
||||
String fingerprint = cryptoKeypath.getSourceFingerprint() == null ? KeyDerivation.DEFAULT_WATCH_ONLY_FINGERPRINT : Utils.bytesToHex(cryptoKeypath.getSourceFingerprint());
|
||||
return new KeyDerivation(fingerprint, KeyDerivation.writePath(path));
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ public class Descriptor implements WalletImport, WalletExport {
|
||||
private static Wallet ensureKeyDerivations(Wallet wallet) {
|
||||
for(Keystore keystore : wallet.getKeystores()) {
|
||||
if(keystore.getKeyDerivation().getMasterFingerprint() == null || keystore.getKeyDerivation().getDerivationPath() == null) {
|
||||
keystore.setKeyDerivation(new KeyDerivation(KeystoreController.DEFAULT_WATCH_ONLY_FINGERPRINT, wallet.getScriptType().getDefaultDerivationPath()));
|
||||
keystore.setKeyDerivation(new KeyDerivation(KeyDerivation.DEFAULT_WATCH_ONLY_FINGERPRINT, wallet.getScriptType().getDefaultDerivationPath()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public class KeystoreImportDialog extends Dialog<Keystore> {
|
||||
keystore.setLabel(existingLabel);
|
||||
keystore.setSource(KeystoreSource.SW_WATCH);
|
||||
keystore.setWalletModel(WalletModel.SPARROW);
|
||||
keystore.setKeyDerivation(new KeyDerivation(KeystoreController.DEFAULT_WATCH_ONLY_FINGERPRINT, scriptType.getDefaultDerivationPath()));
|
||||
keystore.setKeyDerivation(new KeyDerivation(KeyDerivation.DEFAULT_WATCH_ONLY_FINGERPRINT, scriptType.getDefaultDerivationPath()));
|
||||
return keystore;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.sparrowwallet.sparrow.wallet.KeystoreController.DEFAULT_WATCH_ONLY_FINGERPRINT;
|
||||
|
||||
public class WatchOnlyDialog extends NewWalletDialog {
|
||||
private static final Logger log = LoggerFactory.getLogger(WatchOnlyDialog.class);
|
||||
|
||||
@@ -126,7 +124,7 @@ public class WatchOnlyDialog extends NewWalletDialog {
|
||||
Keystore keystore = new Keystore();
|
||||
keystore.setSource(KeystoreSource.SW_WATCH);
|
||||
keystore.setWalletModel(WalletModel.SPARROW);
|
||||
keystore.setKeyDerivation(new KeyDerivation(DEFAULT_WATCH_ONLY_FINGERPRINT, scriptType.getDefaultDerivationPath()));
|
||||
keystore.setKeyDerivation(new KeyDerivation(KeyDerivation.DEFAULT_WATCH_ONLY_FINGERPRINT, scriptType.getDefaultDerivationPath()));
|
||||
keystore.setExtendedPublicKey(xpub);
|
||||
wallet.makeLabelsUnique(keystore);
|
||||
wallet.getKeystores().add(keystore);
|
||||
|
||||
@@ -44,8 +44,6 @@ import static com.sparrowwallet.sparrow.io.CardApi.isReaderAvailable;
|
||||
public class KeystoreController extends WalletFormController implements Initializable {
|
||||
private static final Logger log = LoggerFactory.getLogger(KeystoreController.class);
|
||||
|
||||
public static final String DEFAULT_WATCH_ONLY_FINGERPRINT = "00000000";
|
||||
|
||||
private Keystore keystore;
|
||||
|
||||
@FXML
|
||||
@@ -252,7 +250,7 @@ public class KeystoreController extends WalletFormController implements Initiali
|
||||
if(keystoreSource != KeystoreSource.SW_WATCH) {
|
||||
launchImportDialog(keystoreSource);
|
||||
} else {
|
||||
fingerprint.setText(DEFAULT_WATCH_ONLY_FINGERPRINT);
|
||||
fingerprint.setText(KeyDerivation.DEFAULT_WATCH_ONLY_FINGERPRINT);
|
||||
derivation.setText(getWalletForm().getWallet().getScriptType().getDefaultDerivationPath());
|
||||
selectSourcePane.setVisible(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user