From 4c4ba6329ebddb1fd7d083bf9f4e6ca3692f5498 Mon Sep 17 00:00:00 2001 From: Jason Ribble Date: Fri, 2 Feb 2024 19:34:36 -0700 Subject: [PATCH] fix: taproot derived xpub --- src/bitcoin/keys.rs | 2 +- tests/keys.rs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bitcoin/keys.rs b/src/bitcoin/keys.rs index da342620..92f89445 100644 --- a/src/bitcoin/keys.rs +++ b/src/bitcoin/keys.rs @@ -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, diff --git a/tests/keys.rs b/tests/keys.rs index 600d4a08..ef7f2db4 100644 --- a/tests/keys.rs +++ b/tests/keys.rs @@ -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"; @@ -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"