Skip to content

Commit faba118

Browse files
OttoAllmendingerllm-git
andcommitted
feat(wasm-utxo): update seed derivation in test utils to match TS
Update the derivation path separator in the test wallet keys function to use a period (.) instead of a slash (/) to match the TypeScript implementation in keys.ts. Issue: BTC-2893 Co-authored-by: llm-git <[email protected]>
1 parent 94cf7f5 commit faba118

File tree

1 file changed

+6
-3
lines changed
  • packages/wasm-utxo/src/fixed_script_wallet/test_utils

1 file changed

+6
-3
lines changed

packages/wasm-utxo/src/fixed_script_wallet/test_utils/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::collections::BTreeMap;
1212
use std::str::FromStr;
1313

1414
/// Get test wallet xpubs from a seed string
15+
/// This matches the TypeScript getWalletKeysForSeed function from keys.ts
1516
pub fn get_test_wallet_keys(seed: &str) -> XpubTriple {
1617
use crate::bitcoin::hashes::{sha256, Hash};
1718
use crate::bitcoin::Network;
@@ -21,9 +22,11 @@ pub fn get_test_wallet_keys(seed: &str) -> XpubTriple {
2122
Xpriv::new_master(Network::Testnet, &seed_hash).expect("could not create xpriv from seed")
2223
}
2324

24-
let a = get_xpriv_from_seed(&format!("{}/0", seed));
25-
let b = get_xpriv_from_seed(&format!("{}/1", seed));
26-
let c = get_xpriv_from_seed(&format!("{}/2", seed));
25+
// Note: TypeScript uses `.` separator (e.g., "seed.0", "seed.1", "seed.2")
26+
// to match utxo-lib's getKeyTriple function in keys.ts
27+
let a = get_xpriv_from_seed(&format!("{}.0", seed));
28+
let b = get_xpriv_from_seed(&format!("{}.1", seed));
29+
let c = get_xpriv_from_seed(&format!("{}.2", seed));
2730

2831
let secp = crate::bitcoin::secp256k1::Secp256k1::new();
2932
[a, b, c].map(|x| Xpub::from_priv(&secp, &x))

0 commit comments

Comments
 (0)