File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -668,19 +668,13 @@ 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 < _ > > ( )
671
+ let mut keys = vec ! [ ] ;
672
+ for data in self . post_order_iter ( ) {
673
+ if let Policy :: Key ( ref pk ) = data . node {
674
+ keys. push ( pk ) ;
675
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
676
}
677
+ keys
684
678
}
685
679
686
680
/// 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