pczt/roles/verifier/
transparent.rs1use crate::Pczt;
2
3impl super::Verifier {
4 pub fn with_transparent<E, F>(self, f: F) -> Result<Self, TransparentError<E>>
6 where
7 F: FnOnce(
8 &transparent::pczt::Bundle<zcash_protocol::value::Zatoshis>,
9 ) -> Result<(), TransparentError<E>>,
10 {
11 let Pczt {
12 global,
13 transparent,
14 sapling,
15 orchard,
16 ironwood,
17 } = self.pczt;
18
19 let bundle = transparent
20 .into_parsed()
21 .map_err(TransparentError::Parser)?;
22
23 f(&bundle)?;
24
25 Ok(Self {
26 pczt: Pczt {
27 global,
28 transparent: crate::transparent::Bundle::serialize_from(bundle),
29 sapling,
30 orchard,
31 ironwood,
32 },
33 })
34 }
35}
36
37#[derive(Debug)]
39pub enum TransparentError<E> {
40 Parser(transparent::pczt::ParseError),
41 Verifier(transparent::pczt::VerifyError),
42 Custom(E),
43}
44
45impl<E> From<transparent::pczt::VerifyError> for TransparentError<E> {
46 fn from(e: transparent::pczt::VerifyError) -> Self {
47 TransparentError::Verifier(e)
48 }
49}