From 869f3ec3d2c6b4f367f8b23f3e45dbfe1ae9fdf1 Mon Sep 17 00:00:00 2001 From: edouard Date: Thu, 20 Jul 2023 15:32:21 +0200 Subject: [PATCH] installer: disallow xpub with-appended derivation path close #576 --- gui/src/installer/step/descriptor.rs | 4 +++- gui/src/installer/view.rs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gui/src/installer/step/descriptor.rs b/gui/src/installer/step/descriptor.rs index 3849dcc3..882f13b1 100644 --- a/gui/src/installer/step/descriptor.rs +++ b/gui/src/installer/step/descriptor.rs @@ -883,7 +883,9 @@ impl DescriptorEditModal for EditXpubModal { message::ImportKeyModal::XPubEdited(s) => { if let Ok(DescriptorPublicKey::XPub(key)) = DescriptorPublicKey::from_str(&s) { self.chosen_signer = None; - if let Some((fingerprint, _)) = key.origin { + if !key.derivation_path.is_master() { + self.form_xpub.valid = false; + } else if let Some((fingerprint, _)) = key.origin { self.form_xpub.valid = true; if let Some(alias) = self.keys_aliases.get(&fingerprint) { self.form_name.valid = true; diff --git a/gui/src/installer/view.rs b/gui/src/installer/view.rs index 2c9278a5..6dfa6cd8 100644 --- a/gui/src/installer/view.rs +++ b/gui/src/installer/view.rs @@ -1304,9 +1304,9 @@ pub fn edit_key_modal<'a>( ) }) .warning(if network == bitcoin::Network::Bitcoin { - "Please enter correct xpub with origin" + "Please enter correct xpub with origin and without appended derivation path" } else { - "Please enter correct tpub with origin" + "Please enter correct tpub with origin and without appended derivation path" }) .size(20) .padding(10),