use orchard::pczt::{ParseError, Updater, UpdaterError};
use crate::Pczt;
impl super::Updater {
pub fn update_orchard_with<F>(self, f: F) -> Result<Self, OrchardError>
where
F: FnOnce(Updater<'_>) -> Result<(), UpdaterError>,
{
let Pczt {
global,
transparent,
sapling,
orchard,
} = self.pczt;
let mut bundle = orchard.into_parsed().map_err(OrchardError::Parser)?;
bundle.update_with(f).map_err(OrchardError::Updater)?;
Ok(Self {
pczt: Pczt {
global,
transparent,
sapling,
orchard: crate::orchard::Bundle::serialize_from(bundle),
},
})
}
}
#[derive(Debug)]
pub enum OrchardError {
Parser(ParseError),
Updater(UpdaterError),
}