Skip to content

Commit

Permalink
fix: taproot derived xpub
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonribble committed Feb 3, 2024
1 parent ba71951 commit 4c4ba63
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/bitcoin/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ pub async fn get_mnemonic(
};

let public = PublicWalletData {
xpub: xpub.to_string(),
xpub: watcher_xpub.clone(),
xpubkh,
watcher_xpub,
btc_descriptor_xpub,
Expand Down
8 changes: 7 additions & 1 deletion tests/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use bitmask_core::{

#[tokio::test]
pub async fn taproot() -> Result<()> {
init_logging("nostr_tests=debug");
init_logging("taproot=debug");

const MNEMONIC: &str =
"empty faculty salute fortune select asthma attract question violin movie smile erupt half step lion deposit render stumble double mobile fossil height usual topple";
Expand All @@ -36,6 +36,12 @@ pub async fn taproot() -> Result<()> {
"correct taproot xpub descriptor is derived from mnemonic"
);

assert_eq!(
decrypted_wallet.public.xpub,
"xpub6CBkARCPxmbRjaxzHxC38e9sKUVtMTRFqBYUFdXAHFBpeQzJz6mYSaQ1qSvCrNzYUNuvpD9FS6fmK9YowdCxaiCUSpjzNm5hvV2JxEodZ1q",
"correct taproot xpub is derived from mnemonic"
);

assert_eq!(
wallet_data.address, "bc1pljwytlvv9n8ug5e7cxrjrfmhudd2w7r0nmdpt7j0387mc0zzpveq6jeqs6",
"correct first address is derived"
Expand Down

0 comments on commit 4c4ba63

Please sign in to comment.