@@ -29,6 +29,9 @@ use crate::miniscript::types::extra_props::TimelockInfo;
2929use crate :: prelude:: * ;
3030use crate :: { errstr, Error , ForEachKey , MiniscriptKey , Translator } ;
3131
32+ #[ cfg( all( doc, not( feature = "compiler" ) ) ) ]
33+ use crate :: Descriptor ;
34+
3235/// Maximum TapLeafs allowed in a compiled TapTree
3336#[ cfg( feature = "compiler" ) ]
3437const MAX_COMPILATION_LEAVES : usize = 1024 ;
@@ -207,18 +210,18 @@ pub enum PolicyError {
207210 DuplicatePubKeys ,
208211}
209212
210- /// Descriptor context for [`Policy`] compilation into a [`Descriptor`]
213+ /// Descriptor context for [`Policy`] compilation into a [`Descriptor`].
211214pub enum DescriptorCtx < Pk > {
212- /// [Bare][ `Descriptor::Bare`]
215+ /// See docs for [ `Descriptor::Bare`].
213216 Bare ,
214- /// [Sh][ `Descriptor::Sh`]
217+ /// See docs for [ `Descriptor::Sh`].
215218 Sh ,
216- /// [Wsh][ `Descriptor::Wsh`]
219+ /// See docs for [ `Descriptor::Wsh`].
217220 Wsh ,
218- /// Sh-wrapped [Wsh][ `Descriptor::Wsh`]
221+ /// See docs for [ `Descriptor::Wsh`].
219222 ShWsh ,
220- /// [Tr][ `Descriptor::Tr`] where the Option<Pk> corresponds to the internal_key if no internal
221- /// key can be inferred from the given policy
223+ /// [`Descriptor::Tr`] where the ` Option<Pk>` corresponds to the internal key if no
224+ /// internal key can be inferred from the given policy.
222225 Tr ( Option < Pk > ) ,
223226}
224227
@@ -364,7 +367,7 @@ impl<Pk: MiniscriptKey> Policy<Pk> {
364367 }
365368 }
366369
367- /// Compile the [`Policy`] into a [`Tr`][` Descriptor::Tr`] Descriptor .
370+ /// Compile the [`Policy`] into a [`Descriptor::Tr`].
368371 ///
369372 /// ### TapTree compilation
370373 ///
@@ -417,20 +420,26 @@ impl<Pk: MiniscriptKey> Policy<Pk> {
417420 }
418421 }
419422
420- /// Compile the [`Policy`] into a [`Tr`][`Descriptor::Tr`] Descriptor, with policy-enumeration
421- /// by [`Policy::enumerate_policy_tree`].
423+ /// Compiles the [`Policy`] into a [`Descriptor::Tr`].
422424 ///
423425 /// ### TapTree compilation
424426 ///
425- /// The policy tree constructed by root-level disjunctions over [`Or`][` Policy::Or`] and
426- /// [`Thresh`][` Policy::Threshold`](k, ..n..) which is flattened into a vector (with respective
427- /// probabilities derived from odds) of policies.
428- /// For example, the policy `thresh(1,or(pk(A),pk(B)),and(or(pk(C),pk(D)),pk(E)))` gives the vector
427+ /// The policy tree constructed by root-level disjunctions over [`Policy::Or`] and
428+ /// [`Policy::Threshold`] (k, ..n..) which is flattened into a vector (with respective
429+ /// probabilities derived from odds) of policies. For example, the policy
430+ /// `thresh(1,or(pk(A),pk(B)),and(or(pk(C),pk(D)),pk(E)))` gives the vector
429431 /// `[pk(A),pk(B),and(or(pk(C),pk(D)),pk(E)))]`.
430432 ///
431433 /// ### Policy enumeration
432434 ///
433- /// Refer to [`Policy::enumerate_policy_tree`] for the current strategy implemented.
435+ /// Generates a root-level disjunctive tree over the given policy tree.
436+ ///
437+ /// Uses a fixed-point algorithm to enumerate the disjunctions until exhaustive root-level
438+ /// enumeration or limits exceed. For a given [`Policy`], we maintain an [ordered
439+ /// set](`BTreeSet`) of `(prob, policy)` (ordered by probability) to maintain the list of
440+ /// enumerated sub-policies whose disjunction is isomorphic to initial policy (*invariant*).
441+ ///
442+ /// [`Policy`]: crate::policy::concrete::Policy
434443 #[ cfg( feature = "compiler" ) ]
435444 pub fn compile_tr_private_experimental (
436445 & self ,
@@ -537,12 +546,14 @@ impl<Pk: MiniscriptKey> PolicyArc<Pk> {
537546 }
538547 }
539548
540- /// Generates a root-level disjunctive tree over the given policy tree, by using fixed-point
541- /// algorithm to enumerate the disjunctions until exhaustive root-level enumeration or limits
542- /// exceed.
543- /// For a given [policy][`Policy`], we maintain an [ordered set][`BTreeSet`] of `(prob, policy)`
544- /// (ordered by probability) to maintain the list of enumerated sub-policies whose disjunction
545- /// is isomorphic to initial policy (*invariant*).
549+ /// Generates a root-level disjunctive tree over the given policy tree.
550+ ///
551+ /// Uses a fixed-point algorithm to enumerate the disjunctions until exhaustive root-level
552+ /// enumeration or limits exceed. For a given [`Policy`], we maintain an [ordered
553+ /// set](`BTreeSet`) of `(prob, policy)` (ordered by probability) to maintain the list of
554+ /// enumerated sub-policies whose disjunction is isomorphic to initial policy (*invariant*).
555+ ///
556+ /// [`Policy`]: crate::policy::concrete::Policy
546557 #[ cfg( feature = "compiler" ) ]
547558 fn enumerate_policy_tree ( self , prob : f64 ) -> Vec < ( f64 , Arc < Self > ) > {
548559 let mut tapleaf_prob_vec = BTreeSet :: < ( Reverse < OrdF64 > , Arc < Self > ) > :: new ( ) ;
0 commit comments