orchard: move IncomingViewingKey::from([u8; 32]) to a ::from_bytes([u8; 32], Newtwork)
This commit is contained in:
parent
8d357faf73
commit
72491df4ff
|
@ -468,17 +468,6 @@ impl fmt::Display for IncomingViewingKey {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<[u8; 32]> for IncomingViewingKey {
|
|
||||||
/// Generate an _IncomingViewingKey_ from existing bytes.
|
|
||||||
fn from(bytes: [u8; 32]) -> Self {
|
|
||||||
Self {
|
|
||||||
// TODO: handle setting the Network better.
|
|
||||||
network: Network::default(),
|
|
||||||
scalar: pallas::Scalar::from_bytes(&bytes).unwrap(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<FullViewingKey> for IncomingViewingKey {
|
impl From<FullViewingKey> for IncomingViewingKey {
|
||||||
/// Commit^ivk_rivk(ak, nk) :=
|
/// Commit^ivk_rivk(ak, nk) :=
|
||||||
/// SinsemillaShortCommit_rcm (︁"z.cash:Orchard-CommitIvk", I2LEBSP_l(ak) || I2LEBSP_l(nk)︁) mod r_P
|
/// SinsemillaShortCommit_rcm (︁"z.cash:Orchard-CommitIvk", I2LEBSP_l(ak) || I2LEBSP_l(nk)︁) mod r_P
|
||||||
|
@ -542,6 +531,16 @@ impl PartialEq<[u8; 32]> for IncomingViewingKey {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl IncomingViewingKey {
|
||||||
|
/// Generate an _IncomingViewingKey_ from existing bytes and a network variant.
|
||||||
|
fn from_bytes(bytes: [u8; 32], network: Network) -> Self {
|
||||||
|
Self {
|
||||||
|
network,
|
||||||
|
scalar: pallas::Scalar::from_bytes(&bytes).unwrap(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Magic human-readable strings used to identify what networks Orchard full
|
/// Magic human-readable strings used to identify what networks Orchard full
|
||||||
/// viewing keys are associated with when encoded/decoded with bech32.
|
/// viewing keys are associated with when encoded/decoded with bech32.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in New Issue