Merge #1400: gui: add support for tapminiscript on bitbox02

01f6d2b76985a92ec19ccd37a8e4005219b94563 gui: add support for tapminiscript on bitbox02 (pythcoiner)

Pull request description:

  This PR is build on top of #1357, with few adds:
  - get the version from bitbox device
  - check the version for taproot support
  - copy `tap_script_signs` & `tap_key_sig` if present in the pruned psbt after signature

  Tested spending by internal key & taptree w/ differents setups

  ~~Note: this PR use `bitbox-tapminiscript` branch of `async-hwi`~~

ACKs for top commit:
  edouardparis:
    ACK 01f6d2b76985a92ec19ccd37a8e4005219b94563

Tree-SHA512: aa66a0ebe8553fd13dd5e279adaf1360cdce0d4ccb09f49181f20bc5e4c3c653c0ab056c35ac5cf6ccb3eeb696dcfd94463e6235d1cdb2063ecb503695ad4b99
This commit is contained in:
edouardparis 2024-11-04 14:24:56 +01:00
commit 3549a712d5
No known key found for this signature in database
GPG Key ID: E65F7A089C20DC8F
2 changed files with 20 additions and 4 deletions

View File

@ -617,6 +617,12 @@ async fn sign_psbt(
psbt_in
.partial_sigs
.append(&mut pruned_psbt_in.partial_sigs);
if let Some(tap_key_sig) = pruned_psbt_in.tap_key_sig {
psbt_in.tap_key_sig = Some(tap_key_sig);
}
psbt_in
.tap_script_sigs
.append(&mut pruned_psbt_in.tap_script_sigs);
} else {
log::error!(
"Not all PSBT inputs are present in the pruned psbt. Pruned psbt: '{}'.",

View File

@ -246,6 +246,7 @@ impl HardwareWallets {
let fingerprint =
bitbox2.get_master_fingerprint().await?;
let mut registered = false;
let version = bitbox2.get_version().await.ok();
if let Some(wallet) = &wallet {
let desc = wallet.main_descriptor.to_string();
bitbox2 = bitbox2.with_policy(&desc)?;
@ -257,7 +258,7 @@ impl HardwareWallets {
kind: DeviceKind::BitBox02,
fingerprint,
device: bitbox2.into(),
version: None,
version,
registered: Some(registered),
alias: None,
})
@ -265,7 +266,7 @@ impl HardwareWallets {
Ok(HardwareWallet::Unsupported {
id: id.clone(),
kind: DeviceKind::BitBox02,
version: None,
version,
reason: UnsupportedReason::NotPartOfWallet(
fingerprint,
),
@ -277,7 +278,7 @@ impl HardwareWallets {
kind: DeviceKind::BitBox02,
fingerprint,
device: bitbox2.into(),
version: None,
version,
registered: Some(registered),
alias: None,
})
@ -851,7 +852,7 @@ fn ledger_version_supported(version: &Version) -> bool {
// Kind and minimal version of devices supporting tapminiscript.
// We cannot use a lazy_static HashMap yet, because DeviceKind does not implement Hash.
const DEVICES_COMPATIBLE_WITH_TAPMINISCRIPT: [(DeviceKind, Option<Version>); 4] = [
const DEVICES_COMPATIBLE_WITH_TAPMINISCRIPT: [(DeviceKind, Option<Version>); 5] = [
(
DeviceKind::Ledger,
Some(Version {
@ -872,6 +873,15 @@ const DEVICES_COMPATIBLE_WITH_TAPMINISCRIPT: [(DeviceKind, Option<Version>); 4]
prerelease: None,
}),
),
(
DeviceKind::BitBox02,
Some(Version {
major: 9,
minor: 21,
patch: 0,
prerelease: None,
}),
),
];
pub fn is_compatible_with_tapminiscript(