1use crate::Pczt;
9
10#[cfg(feature = "orchard")]
11mod orchard;
12#[cfg(feature = "orchard")]
13pub use orchard::OrchardError;
14
15#[cfg(feature = "sapling")]
16mod sapling;
17#[cfg(feature = "sapling")]
18pub use sapling::SaplingError;
19
20pub struct Prover {
21 pczt: Pczt,
22}
23
24impl Prover {
25 pub fn new(pczt: Pczt) -> Self {
27 Self { pczt }
28 }
29
30 pub fn requires_sapling_proofs(&self) -> bool {
33 let sapling_bundle = self.pczt.sapling();
34
35 sapling_bundle.spends().iter().any(|s| s.zkproof.is_none())
36 || sapling_bundle.outputs().iter().any(|o| o.zkproof.is_none())
37 }
38
39 pub fn requires_orchard_proof(&self) -> bool {
41 !self.pczt.orchard().actions().is_empty() && self.pczt.orchard().zkproof.is_none()
42 }
43
44 pub fn requires_ironwood_proof(&self) -> bool {
46 !self.pczt.ironwood().actions().is_empty() && self.pczt.ironwood().zkproof.is_none()
47 }
48
49 pub fn finish(self) -> Pczt {
51 self.pczt
52 }
53}