Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: taproot derived xpub #449

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading