Compare commits

..

2 Commits

Author SHA1 Message Date
Kris Nuttycombe e15551b618
Merge fa225d479a into 895afe51f7 2024-04-23 22:31:03 +00:00
Kris Nuttycombe fa225d479a Allow transparent-only unified addresses and viewing keys. 2024-04-23 16:30:52 -06:00
1 changed files with 17 additions and 1 deletions

View File

@ -857,7 +857,7 @@ impl UnifiedFullViewingKey {
zcash_address::unified::Ufvk::try_from_items(
if self.expiry_height().is_some()
|| self.expiry_time().is_some()
|| !(self.sapling.is_some() || self.orchard.is_some())
|| !(self.has_sapling() || self.has_orchard())
{
Revision::R1
} else {
@ -904,12 +904,28 @@ impl UnifiedFullViewingKey {
self.sapling.as_ref()
}
/// Returns whether this UFVK contains a Sapling item.
pub fn has_sapling(&self) -> bool {
#[cfg(feature = "sapling")]
return self.sapling.is_some();
#[cfg(not(feature = "sapling"))]
return false;
}
/// Returns the Orchard full viewing key component of this unified key.
#[cfg(feature = "orchard")]
pub fn orchard(&self) -> Option<&orchard::keys::FullViewingKey> {
self.orchard.as_ref()
}
/// Returns whether this UFVK contains an Orchard item.
pub fn has_orchard(&self) -> bool {
#[cfg(feature = "orchard")]
return self.orchard.is_some();
#[cfg(not(feature = "orchard"))]
return false;
}
/// Returns any unknown data items parsed from the encoded form of the key.
pub fn unknown_data(&self) -> &[(u32, Vec<u8>)] {
self.unknown_data.as_ref()