File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -656,19 +656,12 @@ impl<Pk: MiniscriptKey> Policy<Pk> {
656
656
657
657
/// Gets all keys in the policy.
658
658
pub fn keys ( & self ) -> Vec < & Pk > {
659
- match * self {
660
- Policy :: Key ( ref pk) => vec ! [ pk] ,
661
- Policy :: Threshold ( _k, ref subs) => {
662
- subs. iter ( ) . flat_map ( |sub| sub. keys ( ) ) . collect :: < Vec < _ > > ( )
663
- }
664
- Policy :: And ( ref subs) => subs. iter ( ) . flat_map ( |sub| sub. keys ( ) ) . collect :: < Vec < _ > > ( ) ,
665
- Policy :: Or ( ref subs) => subs
666
- . iter ( )
667
- . flat_map ( |( ref _k, ref sub) | sub. keys ( ) )
668
- . collect :: < Vec < _ > > ( ) ,
669
- // map all hashes and time
670
- _ => vec ! [ ] ,
671
- }
659
+ self . pre_order_iter ( )
660
+ . filter_map ( |policy| match policy {
661
+ Policy :: Key ( ref pk) => Some ( pk) ,
662
+ _ => None ,
663
+ } )
664
+ . collect ( )
672
665
}
673
666
674
667
/// Gets the number of [TapLeaf](`TapTree::Leaf`)s considering exhaustive root-level [`Policy::Or`]
You can’t perform that action at this time.
0 commit comments