From 82a68d42fba3178c0c8da1904c9b089c02dd6e65 Mon Sep 17 00:00:00 2001 From: redshiftzero Date: Wed, 11 Dec 2024 15:59:44 -0500 Subject: [PATCH] test: make unit test deterministic (generates test vec in uip 7) --- crates/core/keys/src/keys/ivk.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/core/keys/src/keys/ivk.rs b/crates/core/keys/src/keys/ivk.rs index 171aae0ed8..6defb20736 100644 --- a/crates/core/keys/src/keys/ivk.rs +++ b/crates/core/keys/src/keys/ivk.rs @@ -200,16 +200,20 @@ impl IncomingViewingKeyVar { #[cfg(test)] mod test { - use crate::keys::{Bip44Path, SeedPhrase, SpendKey}; + use crate::{ + keys::{Bip44Path, SeedPhrase, SpendKey}, + test_keys, + }; use proptest::prelude::*; + use std::str::FromStr; use super::*; #[test] fn transparent_address_generation_and_parsing() { - let rng = rand::rngs::OsRng; - let spend_key = - SpendKey::from_seed_phrase_bip44(SeedPhrase::generate(rng), &Bip44Path::new(0)); + // Use test seed phrase for test vector + let seed_phrase = SeedPhrase::from_str(test_keys::SEED_PHRASE).expect("valid seed phrase"); + let spend_key = SpendKey::from_seed_phrase_bip44(seed_phrase, &Bip44Path::new(0)); let ivk = spend_key.full_viewing_key().incoming(); let transparent_address_str = ivk.transparent_address();