@@ -587,61 +587,8 @@ impl Policy {
587
587
Ok ( Some ( policy) )
588
588
}
589
589
590
- fn make_multi < Ctx : ScriptContext + ' static > (
591
- threshold : & Threshold < DescriptorPublicKey , MAX_PUBKEYS_PER_MULTISIG > ,
592
- signers : & SignersContainer ,
593
- build_sat : BuildSatisfaction ,
594
- sorted : bool ,
595
- secp : & SecpCtx ,
596
- ) -> Result < Option < Policy > , PolicyError > {
597
- let parsed_keys = threshold. iter ( ) . map ( |k| PkOrF :: from_key ( k, secp) ) . collect ( ) ;
598
-
599
- let mut contribution = Satisfaction :: Partial {
600
- n : threshold. n ( ) ,
601
- m : threshold. k ( ) ,
602
- items : vec ! [ ] ,
603
- conditions : Default :: default ( ) ,
604
- sorted : Some ( sorted) ,
605
- } ;
606
- let mut satisfaction = contribution. clone ( ) ;
607
-
608
- for ( index, key) in threshold. iter ( ) . enumerate ( ) {
609
- if signers. find ( signer_id ( key, secp) ) . is_some ( ) {
610
- contribution. add (
611
- & Satisfaction :: Complete {
612
- condition : Default :: default ( ) ,
613
- } ,
614
- index,
615
- ) ?;
616
- }
617
-
618
- if let Some ( psbt) = build_sat. psbt ( ) {
619
- if Ctx :: find_signature ( psbt, key, secp) {
620
- satisfaction. add (
621
- & Satisfaction :: Complete {
622
- condition : Default :: default ( ) ,
623
- } ,
624
- index,
625
- ) ?;
626
- }
627
- }
628
- }
629
- satisfaction. finalize ( ) ;
630
- contribution. finalize ( ) ;
631
-
632
- let mut policy: Policy = SatisfiableItem :: Multisig {
633
- keys : parsed_keys,
634
- threshold : threshold. k ( ) ,
635
- }
636
- . into ( ) ;
637
- policy. contribution = contribution;
638
- policy. satisfaction = satisfaction;
639
-
640
- Ok ( Some ( policy) )
641
- }
642
-
643
- fn make_multi_a < Ctx : ScriptContext + ' static > (
644
- threshold : & Threshold < DescriptorPublicKey , MAX_PUBKEYS_IN_CHECKSIGADD > ,
590
+ fn make_multi < Ctx : ScriptContext + ' static , const MAX : usize > (
591
+ threshold : & Threshold < DescriptorPublicKey , MAX > ,
645
592
signers : & SignersContainer ,
646
593
build_sat : BuildSatisfaction ,
647
594
sorted : bool ,
@@ -1038,12 +985,12 @@ impl<Ctx: ScriptContext + 'static> ExtractPolicy for Miniscript<DescriptorPublic
1038
985
Terminal :: Hash160 ( hash) => {
1039
986
Some ( SatisfiableItem :: Hash160Preimage { hash : * hash } . into ( ) )
1040
987
}
1041
- Terminal :: Multi ( threshold) => {
1042
- Policy :: make_multi :: < Ctx > ( threshold, signers, build_sat, false , secp) ?
1043
- }
1044
- Terminal :: MultiA ( threshold) => {
1045
- Policy :: make_multi_a :: < Ctx > ( threshold, signers, build_sat, false , secp) ?
1046
- }
988
+ Terminal :: Multi ( threshold) => Policy :: make_multi :: < Ctx , MAX_PUBKEYS_PER_MULTISIG > (
989
+ threshold, signers, build_sat, false , secp,
990
+ ) ? ,
991
+ Terminal :: MultiA ( threshold) => Policy :: make_multi :: < Ctx , MAX_PUBKEYS_IN_CHECKSIGADD > (
992
+ threshold, signers, build_sat, false , secp,
993
+ ) ? ,
1047
994
// Identities
1048
995
Terminal :: Alt ( inner)
1049
996
| Terminal :: Swap ( inner)
@@ -1145,7 +1092,7 @@ impl ExtractPolicy for Descriptor<DescriptorPublicKey> {
1145
1092
) -> Result < Option < Policy > , Error > {
1146
1093
let threshold = Threshold :: new ( keys. k ( ) , keys. pks ( ) . to_vec ( ) )
1147
1094
. expect ( "valid threshold and pks collection" ) ;
1148
- Ok ( Policy :: make_multi :: < Ctx > (
1095
+ Ok ( Policy :: make_multi :: < Ctx , MAX_PUBKEYS_PER_MULTISIG > (
1149
1096
& threshold, signers, build_sat, true , secp,
1150
1097
) ?)
1151
1098
}
0 commit comments