Skip to content

Commit

Permalink
test: diversifier decryption changes
Browse files Browse the repository at this point in the history
  • Loading branch information
redshiftzero committed Dec 10, 2024
1 parent 00e4bc7 commit f2a5186
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 0 additions & 1 deletion crates/core/keys/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ impl std::str::FromStr for Address {
let pk_dzero = ka::Public(pk_dzero_bytes);

let ck_id = fmd::ClueKey([0u8; 32]);

Self::from_components(dzero, pk_dzero, ck_id)
.ok_or_else(|| anyhow::anyhow!("could not reconstruct transparent address"))
} else if s.starts_with(bech32str::compat_address::BECH32_PREFIX) {
Expand Down
11 changes: 7 additions & 4 deletions crates/core/keys/src/keys/ivk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,13 @@ mod test {

let actual_address = ivk.payment_address(address_index).0;

// The diversifiers should match
assert_eq!(reconstructed.diversifier(), actual_address.diversifier());
// The transmission keys should match
assert_eq!(
// The diversifiers will not match, as the encryption of the 0 account `AddressIndex`
// is not the null ciphertext, so when deriving `actual_address` from the 0 account
// `AddressIndex`, we end up with a different diversifier.
assert_ne!(reconstructed.diversifier(), actual_address.diversifier());
// The transmission keys also will not match, as the null diversifier is not the
// same as the diversifier for the 0 account `AddressIndex`.
assert_ne!(
reconstructed.transmission_key(),
actual_address.transmission_key()
);
Expand Down

0 comments on commit f2a5186

Please sign in to comment.