File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1721,4 +1721,19 @@ pk(03f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8))";
1721
1721
let descriptor: Descriptor < DescriptorPublicKey > = descriptor_str. parse ( ) . unwrap ( ) ;
1722
1722
assert_eq ! ( descriptor. to_string( ) , "sh(wsh(pk(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL)))#6c6hwr22" ) ;
1723
1723
}
1724
+
1725
+ #[ test]
1726
+ fn test_xonly_keys ( ) {
1727
+ let comp_key = "0308c0fcf8895f4361b4fc77afe2ad53b0bd27dcebfd863421b2b246dc283d4103" ;
1728
+ let x_only_key = "08c0fcf8895f4361b4fc77afe2ad53b0bd27dcebfd863421b2b246dc283d4103" ;
1729
+
1730
+ // Both x-only keys and comp keys allowed in tr
1731
+ Descriptor :: < DescriptorPublicKey > :: from_str ( & format ! ( "tr({})" , comp_key) ) . unwrap ( ) ;
1732
+ Descriptor :: < DescriptorPublicKey > :: from_str ( & format ! ( "tr({})" , x_only_key) ) . unwrap ( ) ;
1733
+
1734
+ // Only compressed keys allowed in wsh
1735
+ Descriptor :: < DescriptorPublicKey > :: from_str ( & format ! ( "wsh(pk({}))" , comp_key) ) . unwrap ( ) ;
1736
+ Descriptor :: < DescriptorPublicKey > :: from_str ( & format ! ( "wsh(pk({}))" , x_only_key) )
1737
+ . unwrap_err ( ) ;
1738
+ }
1724
1739
}
You can’t perform that action at this time.
0 commit comments