From 9d0c35bc750091abdca2769b4ff6fde819d7503e Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 18 Mar 2024 07:48:55 +0200 Subject: [PATCH] handle import of ur crypto-hdkey without source fingerprint --- .../java/com/sparrowwallet/sparrow/control/QRScanDialog.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/control/QRScanDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/QRScanDialog.java index c4db84c6..41986d81 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/QRScanDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/QRScanDialog.java @@ -32,6 +32,7 @@ import com.sparrowwallet.sparrow.glyphfont.FontAwesome5; import com.sparrowwallet.sparrow.io.Config; import com.sparrowwallet.sparrow.io.bbqr.BBQRDecoder; import com.sparrowwallet.sparrow.io.bbqr.BBQRException; +import com.sparrowwallet.sparrow.wallet.KeystoreController; import javafx.application.Platform; import javafx.beans.property.DoubleProperty; import javafx.beans.property.ObjectProperty; @@ -621,7 +622,8 @@ public class QRScanDialog extends Dialog { List path = cryptoKeypath.getComponents().stream().map(comp -> (IndexPathComponent)comp) .map(comp -> new ChildNumber(comp.getIndex(), comp.isHardened())).collect(Collectors.toList()); - return new KeyDerivation(Utils.bytesToHex(cryptoKeypath.getSourceFingerprint()), KeyDerivation.writePath(path)); + String fingerprint = cryptoKeypath.getSourceFingerprint() == null ? KeystoreController.DEFAULT_WATCH_ONLY_FINGERPRINT : Utils.bytesToHex(cryptoKeypath.getSourceFingerprint()); + return new KeyDerivation(fingerprint, KeyDerivation.writePath(path)); } return null;