@@ -16,7 +16,7 @@ use {MiniscriptKey, ToPublicKey};
1616#[ derive( Debug , Eq , PartialEq , Clone , Ord , PartialOrd , Hash ) ]
1717pub enum DescriptorPublicKey {
1818 /// Single public key.
19- SinglePub ( DescriptorSinglePub ) ,
19+ Single ( SinglePub ) ,
2020 /// Extended public key (xpub).
2121 XPub ( DescriptorXKey < bip32:: ExtendedPubKey > ) ,
2222}
@@ -25,14 +25,14 @@ pub enum DescriptorPublicKey {
2525#[ derive( Debug ) ]
2626pub enum DescriptorSecretKey {
2727 /// Single private key.
28- SinglePriv ( DescriptorSinglePriv ) ,
28+ Single ( SinglePriv ) ,
2929 /// Extended private key (xpriv).
3030 XPrv ( DescriptorXKey < bip32:: ExtendedPrivKey > ) ,
3131}
3232
3333/// A descriptor [`SinglePubKey`] with optional origin information.
3434#[ derive( Debug , Eq , PartialEq , Clone , Ord , PartialOrd , Hash ) ]
35- pub struct DescriptorSinglePub {
35+ pub struct SinglePub {
3636 /// Origin information (fingerprint and derivation path).
3737 pub origin : Option < ( bip32:: Fingerprint , bip32:: DerivationPath ) > ,
3838 /// The public key.
@@ -41,7 +41,7 @@ pub struct DescriptorSinglePub {
4141
4242/// A descriptor [`bitcoin::PrivateKey`] with optional origin information.
4343#[ derive( Debug ) ]
44- pub struct DescriptorSinglePriv {
44+ pub struct SinglePriv {
4545 /// Origin information (fingerprint and derivation path).
4646 pub origin : Option < ( bip32:: Fingerprint , bip32:: DerivationPath ) > ,
4747 /// The private key.
@@ -73,7 +73,7 @@ pub enum SinglePubKey {
7373impl fmt:: Display for DescriptorSecretKey {
7474 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
7575 match self {
76- & DescriptorSecretKey :: SinglePriv ( ref sk) => {
76+ & DescriptorSecretKey :: Single ( ref sk) => {
7777 maybe_fmt_master_id ( f, & sk. origin ) ?;
7878 sk. key . fmt ( f) ?;
7979 Ok ( ( ) )
@@ -136,15 +136,15 @@ pub enum Wildcard {
136136 Hardened ,
137137}
138138
139- impl DescriptorSinglePriv {
139+ impl SinglePriv {
140140 /// Returns the public key of this key
141141 fn as_public < C : Signing > (
142142 & self ,
143143 secp : & Secp256k1 < C > ,
144- ) -> Result < DescriptorSinglePub , DescriptorKeyParseError > {
144+ ) -> Result < SinglePub , DescriptorKeyParseError > {
145145 let pub_key = self . key . public_key ( secp) ;
146146
147- Ok ( DescriptorSinglePub {
147+ Ok ( SinglePub {
148148 origin : self . origin . clone ( ) ,
149149 key : SinglePubKey :: FullKey ( pub_key) ,
150150 } )
@@ -218,7 +218,7 @@ impl error::Error for DescriptorKeyParseError {}
218218impl fmt:: Display for DescriptorPublicKey {
219219 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
220220 match * self {
221- DescriptorPublicKey :: SinglePub ( ref pk) => {
221+ DescriptorPublicKey :: Single ( ref pk) => {
222222 maybe_fmt_master_id ( f, & pk. origin ) ?;
223223 match pk. key {
224224 SinglePubKey :: FullKey ( full_key) => full_key. fmt ( f) ,
@@ -243,7 +243,7 @@ impl fmt::Display for DescriptorPublicKey {
243243
244244impl DescriptorSecretKey {
245245 /// Return the public version of this key, by applying either
246- /// [`DescriptorSinglePriv ::as_public`] or [`DescriptorXKey<bip32::ExtendedPrivKey>::as_public`]
246+ /// [`SinglePriv ::as_public`] or [`DescriptorXKey<bip32::ExtendedPrivKey>::as_public`]
247247 /// depending on the type of key.
248248 ///
249249 /// If the key is an "XPrv", the hardened derivation steps will be applied before converting it
@@ -254,8 +254,8 @@ impl DescriptorSecretKey {
254254 secp : & Secp256k1 < C > ,
255255 ) -> Result < DescriptorPublicKey , DescriptorKeyParseError > {
256256 Ok ( match self {
257- & DescriptorSecretKey :: SinglePriv ( ref sk) => {
258- DescriptorPublicKey :: SinglePub ( sk. as_public ( secp) ?)
257+ & DescriptorSecretKey :: Single ( ref sk) => {
258+ DescriptorPublicKey :: Single ( sk. as_public ( secp) ?)
259259 }
260260 & DescriptorSecretKey :: XPrv ( ref xprv) => {
261261 DescriptorPublicKey :: XPub ( xprv. as_public ( secp) ?)
@@ -340,10 +340,7 @@ impl FromStr for DescriptorPublicKey {
340340 ) )
341341 }
342342 } ;
343- Ok ( DescriptorPublicKey :: SinglePub ( DescriptorSinglePub {
344- key,
345- origin,
346- } ) )
343+ Ok ( DescriptorPublicKey :: Single ( SinglePub { key, origin } ) )
347344 }
348345 }
349346}
@@ -384,7 +381,7 @@ impl DescriptorPublicKey {
384381 xpub. xkey . fingerprint ( )
385382 }
386383 }
387- DescriptorPublicKey :: SinglePub ( ref single) => {
384+ DescriptorPublicKey :: Single ( ref single) => {
388385 if let Some ( ( fingerprint, _) ) = single. origin {
389386 fingerprint
390387 } else {
@@ -416,7 +413,7 @@ impl DescriptorPublicKey {
416413 } ;
417414 origin_path. extend ( & xpub. derivation_path )
418415 }
419- DescriptorPublicKey :: SinglePub ( ref single) => {
416+ DescriptorPublicKey :: Single ( ref single) => {
420417 if let Some ( ( _, ref path) ) = single. origin {
421418 path. clone ( )
422419 } else {
@@ -429,7 +426,7 @@ impl DescriptorPublicKey {
429426 /// Whether or not the key has a wildcards
430427 pub fn is_deriveable ( & self ) -> bool {
431428 match * self {
432- DescriptorPublicKey :: SinglePub ( ..) => false ,
429+ DescriptorPublicKey :: Single ( ..) => false ,
433430 DescriptorPublicKey :: XPub ( ref xpub) => xpub. wildcard != Wildcard :: None ,
434431 }
435432 }
@@ -475,7 +472,7 @@ impl DescriptorPublicKey {
475472 secp : & Secp256k1 < C > ,
476473 ) -> Result < bitcoin:: PublicKey , ConversionError > {
477474 match * self {
478- DescriptorPublicKey :: SinglePub ( ref pk) => match pk. key {
475+ DescriptorPublicKey :: Single ( ref pk) => match pk. key {
479476 SinglePubKey :: FullKey ( pk) => Ok ( pk) ,
480477 SinglePubKey :: XOnly ( xpk) => Ok ( xpk. to_public_key ( ) ) ,
481478 } ,
@@ -503,7 +500,7 @@ impl FromStr for DescriptorSecretKey {
503500 if key_part. len ( ) <= 52 {
504501 let sk = bitcoin:: PrivateKey :: from_str ( key_part)
505502 . map_err ( |_| DescriptorKeyParseError ( "Error while parsing a WIF private key" ) ) ?;
506- Ok ( DescriptorSecretKey :: SinglePriv ( DescriptorSinglePriv {
503+ Ok ( DescriptorSecretKey :: Single ( SinglePriv {
507504 key : sk,
508505 origin : None ,
509506 } ) )
@@ -693,7 +690,7 @@ impl MiniscriptKey for DescriptorPublicKey {
693690
694691 fn is_uncompressed ( & self ) -> bool {
695692 match self {
696- DescriptorPublicKey :: SinglePub ( DescriptorSinglePub {
693+ DescriptorPublicKey :: Single ( SinglePub {
697694 key : SinglePubKey :: FullKey ( ref key) ,
698695 ..
699696 } ) => key. is_uncompressed ( ) ,
@@ -703,7 +700,7 @@ impl MiniscriptKey for DescriptorPublicKey {
703700
704701 fn is_x_only_key ( & self ) -> bool {
705702 match self {
706- DescriptorPublicKey :: SinglePub ( DescriptorSinglePub {
703+ DescriptorPublicKey :: Single ( SinglePub {
707704 key : SinglePubKey :: XOnly ( ref _key) ,
708705 ..
709706 } ) => true ,
0 commit comments