Skip to content

Commit ff3ae26

Browse files
committed
Use Abstract type alias in Liftable for Tr
Make it explicit that the `Policy` returned by `lift` in the `descriptor::tr` module is a `r#abstract::Policy`.
1 parent 0fcfa70 commit ff3ae26

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/descriptor/tr.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::expression::{self, FromTree};
1616
use crate::miniscript::satisfy::{Placeholder, Satisfaction, SchnorrSigType, Witness};
1717
use crate::miniscript::Miniscript;
1818
use crate::plan::AssetProvider;
19-
use crate::policy::r#abstract::Policy;
19+
use crate::policy::r#abstract::Policy as Abstract;
2020
use crate::prelude::*;
2121
use crate::r#abstract::Liftable;
2222
use crate::util::{varint_len, witness_size};
@@ -617,11 +617,11 @@ fn split_once(inp: &str, delim: char) -> Option<(&str, &str)> {
617617
}
618618

619619
impl<Pk: MiniscriptKey> Liftable<Pk> for TapTree<Pk> {
620-
fn lift(&self) -> Result<Policy<Pk>, Error> {
621-
fn lift_helper<Pk: MiniscriptKey>(s: &TapTree<Pk>) -> Result<Policy<Pk>, Error> {
620+
fn lift(&self) -> Result<Abstract<Pk>, Error> {
621+
fn lift_helper<Pk: MiniscriptKey>(s: &TapTree<Pk>) -> Result<Abstract<Pk>, Error> {
622622
match *s {
623623
TapTree::Tree { ref left, ref right, height: _ } => {
624-
Ok(Policy::Threshold(1, vec![lift_helper(left)?, lift_helper(right)?]))
624+
Ok(Abstract::Threshold(1, vec![lift_helper(left)?, lift_helper(right)?]))
625625
}
626626
TapTree::Leaf(ref leaf) => leaf.lift(),
627627
}
@@ -633,12 +633,12 @@ impl<Pk: MiniscriptKey> Liftable<Pk> for TapTree<Pk> {
633633
}
634634

635635
impl<Pk: MiniscriptKey> Liftable<Pk> for Tr<Pk> {
636-
fn lift(&self) -> Result<Policy<Pk>, Error> {
636+
fn lift(&self) -> Result<Abstract<Pk>, Error> {
637637
match &self.tree {
638638
Some(root) => {
639-
Ok(Policy::Threshold(1, vec![Policy::Key(self.internal_key.clone()), root.lift()?]))
639+
Ok(Abstract::Threshold(1, vec![Abstract::Key(self.internal_key.clone()), root.lift()?]))
640640
}
641-
None => Ok(Policy::Key(self.internal_key.clone())),
641+
None => Ok(Abstract::Key(self.internal_key.clone())),
642642
}
643643
}
644644
}

0 commit comments

Comments
 (0)