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 @@ -668,19 +668,12 @@ impl<Pk: MiniscriptKey> Policy<Pk> {
668
668
669
669
/// Gets all keys in the policy.
670
670
pub fn keys ( & self ) -> Vec < & Pk > {
671
- match * self {
672
- Policy :: Key ( ref pk) => vec ! [ pk] ,
673
- Policy :: Threshold ( _k, ref subs) => {
674
- subs. iter ( ) . flat_map ( |sub| sub. keys ( ) ) . collect :: < Vec < _ > > ( )
675
- }
676
- Policy :: And ( ref subs) => subs. iter ( ) . flat_map ( |sub| sub. keys ( ) ) . collect :: < Vec < _ > > ( ) ,
677
- Policy :: Or ( ref subs) => subs
678
- . iter ( )
679
- . flat_map ( |( ref _k, ref sub) | sub. keys ( ) )
680
- . collect :: < Vec < _ > > ( ) ,
681
- // map all hashes and time
682
- _ => vec ! [ ] ,
683
- }
671
+ self . pre_order_iter ( )
672
+ . filter_map ( |policy| match policy {
673
+ Policy :: Key ( ref pk) => Some ( pk) ,
674
+ _ => None ,
675
+ } )
676
+ . collect ( )
684
677
}
685
678
686
679
/// 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