@@ -234,7 +234,7 @@ impl<Pk: MiniscriptKey, Ext: Extension> fmt::Display for TapTree<Pk, Ext> {
234
234
match self {
235
235
TapTree :: Tree ( ref left, ref right) => write ! ( f, "{{{},{}}}" , * left, * right) ,
236
236
TapTree :: Leaf ( ref script) => write ! ( f, "{}" , * script) ,
237
- TapTree :: SimplicityLeaf ( ref policy) => write ! ( f, "{ }" , policy) ,
237
+ TapTree :: SimplicityLeaf ( ref policy) => write ! ( f, "sim{{{}} }" , policy) ,
238
238
}
239
239
}
240
240
}
@@ -949,15 +949,17 @@ mod tests {
949
949
fn tr_from_str ( ) {
950
950
// Key spend only
951
951
952
- let desc = "eltr(internal)" ;
953
- let desc = Tr :: < String , NoExt > :: from_str ( desc) . unwrap ( ) ;
952
+ let desc_str = "eltr(internal)#0aen4jhp" ;
953
+ let desc = Tr :: < String , NoExt > :: from_str ( desc_str) . unwrap ( ) ;
954
+ assert_eq ! ( desc_str, & desc. to_string( ) ) ;
954
955
assert_eq ! ( "internal" , desc. internal_key) ;
955
956
assert ! ( desc. iter_scripts( ) . next( ) . is_none( ) ) ;
956
957
957
958
// Miniscript key spend
958
959
959
- let desc = "eltr(internal,pk(a))" ;
960
- let desc = Tr :: < String , NoExt > :: from_str ( desc) . unwrap ( ) ;
960
+ let desc_str = "eltr(internal,pk(a))#vadmk9gd" ;
961
+ let desc = Tr :: < String , NoExt > :: from_str ( desc_str) . unwrap ( ) ;
962
+ assert_eq ! ( desc_str, & desc. to_string( ) ) ;
961
963
assert_eq ! ( "internal" , desc. internal_key) ;
962
964
963
965
let scripts: Vec < _ > = desc. iter_scripts ( ) . collect ( ) ;
@@ -967,8 +969,9 @@ mod tests {
967
969
968
970
// Simplicity key spend
969
971
970
- let desc = "eltr(internal,sim{pk(a)})" ;
971
- let desc = Tr :: < String , NoExt > :: from_str ( desc) . unwrap ( ) ;
972
+ let desc_str = "eltr(internal,sim{pk(a)})#duhmnzmm" ;
973
+ let desc = Tr :: < String , NoExt > :: from_str ( desc_str) . unwrap ( ) ;
974
+ assert_eq ! ( desc_str, & desc. to_string( ) ) ;
972
975
assert_eq ! ( "internal" , desc. internal_key) ;
973
976
974
977
let policy = desc. get_simplicity ( ) . expect ( "single simplicity leaf" ) ;
0 commit comments