Skip to content

Commit

Permalink
fix: remove unit test and fix nut13::derive_path_from_keyset_id
Browse files Browse the repository at this point in the history
  • Loading branch information
vnprc committed Nov 13, 2024
1 parent 67fc241 commit 2cc8618
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
11 changes: 0 additions & 11 deletions crates/cdk/src/nuts/nut02.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,17 +495,6 @@ mod test {
assert_eq!(864559728, id_int)
}

#[test]
fn test_to_u64_and_back() {
let id = Id::from_str("009a1f293253e41e").unwrap();

let id_long = u64::try_from(id).unwrap();
assert_eq!(43381408211919902, id_long);

let new_id = Id::try_from(id_long).unwrap();
assert_eq!(id, new_id);
}

#[test]
fn test_id_from_invalid_byte_length() {
let three_bytes = [0x01, 0x02, 0x03];
Expand Down
2 changes: 1 addition & 1 deletion crates/cdk/src/nuts/nut13.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl PreMintSecrets {
}

fn derive_path_from_keyset_id(id: Id) -> Result<DerivationPath, Error> {
let index = (u64::try_from(id)? % (2u64.pow(31) - 1)) as u32;
let index = u32::try_from(id)? % (2u32.pow(31) - 1);
let keyset_child_number = ChildNumber::from_hardened_idx(index)?;
Ok(DerivationPath::from(vec![
ChildNumber::from_hardened_idx(129372)?,
Expand Down

0 comments on commit 2cc8618

Please sign in to comment.