@@ -28,7 +28,7 @@ use sync::Arc;
28
28
29
29
use super :: context:: SigType ;
30
30
use crate :: descriptor:: DescriptorType ;
31
- use crate :: plan:: { AssetProvider , Plan } ;
31
+ use crate :: plan:: { AssetProvider , Plan , RequiredPreimage , RequiredSig } ;
32
32
use crate :: prelude:: * ;
33
33
use crate :: util:: witness_size;
34
34
use crate :: {
@@ -721,6 +721,35 @@ impl<Pk: MiniscriptKey + ToPublicKey> WitnessTemplate<Placeholder<Pk>> {
721
721
. collect ( ) ,
722
722
}
723
723
}
724
+
725
+ /// Returns the list of required signatures
726
+ pub fn required_signatures ( & self ) -> Vec < RequiredSig < ' _ , Pk > > {
727
+ self . stack
728
+ . iter ( )
729
+ . filter_map ( |item| match item {
730
+ Placeholder :: EcdsaSigPk ( pk) => Some ( RequiredSig :: Ecdsa ( pk) ) ,
731
+ Placeholder :: SchnorrSig ( pk, None ) => Some ( RequiredSig :: SchnorrTapKey ( pk) ) ,
732
+ Placeholder :: SchnorrSig ( pk, Some ( lh) ) => {
733
+ Some ( RequiredSig :: SchnorrTapScript ( pk, lh) )
734
+ }
735
+ _ => None ,
736
+ } )
737
+ . collect ( )
738
+ }
739
+
740
+ /// Returns the list of required preimages
741
+ pub fn required_preimages ( & self ) -> Vec < RequiredPreimage < ' _ , Pk > > {
742
+ self . stack
743
+ . iter ( )
744
+ . filter_map ( |item| match item {
745
+ Placeholder :: Sha256Preimage ( h) => Some ( RequiredPreimage :: Sha256 ( h) ) ,
746
+ Placeholder :: Hash256Preimage ( h) => Some ( RequiredPreimage :: Hash256 ( h) ) ,
747
+ Placeholder :: Ripemd160Preimage ( h) => Some ( RequiredPreimage :: Ripemd160 ( h) ) ,
748
+ Placeholder :: Hash160Preimage ( h) => Some ( RequiredPreimage :: Hash160 ( h) ) ,
749
+ _ => None ,
750
+ } )
751
+ . collect ( )
752
+ }
724
753
}
725
754
726
755
impl < Pk : MiniscriptKey + ToPublicKey > WitnessTemplate < PartialSatisfaction < Pk > > {
0 commit comments