use crate::Pczt;
impl super::Verifier {
pub fn with_orchard<E, F>(self, f: F) -> Result<Self, OrchardError<E>>
where
F: FnOnce(&orchard::pczt::Bundle) -> Result<(), OrchardError<E>>,
{
let Pczt {
global,
transparent,
sapling,
orchard,
} = self.pczt;
let bundle = orchard.into_parsed().map_err(OrchardError::Parse)?;
f(&bundle)?;
Ok(Self {
pczt: Pczt {
global,
transparent,
sapling,
orchard: crate::orchard::Bundle::serialize_from(bundle),
},
})
}
}
#[derive(Debug)]
pub enum OrchardError<E> {
Parse(orchard::pczt::ParseError),
Verify(orchard::pczt::VerifyError),
Custom(E),
}
impl<E> From<orchard::pczt::VerifyError> for OrchardError<E> {
fn from(e: orchard::pczt::VerifyError) -> Self {
OrchardError::Verify(e)
}
}