Skip to content

Commit 33af3ad

Browse files
committed
Improve docs on key structs
Improve the documentation on the various key structs.
1 parent 3bed0db commit 33af3ad

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/descriptor/key.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,43 @@ use bitcoin::{
1212

1313
use {MiniscriptKey, ToPublicKey};
1414

15-
/// The MiniscriptKey corresponding to Descriptors. This can
16-
/// either be Single public key or a Xpub
15+
/// The descriptor pubkey, either a single pubkey or an xpub.
1716
#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash)]
1817
pub enum DescriptorPublicKey {
19-
/// Single Public Key
18+
/// Single public key.
2019
SinglePub(DescriptorSinglePub),
21-
/// Xpub
20+
/// Extended public key (xpub).
2221
XPub(DescriptorXKey<bip32::ExtendedPubKey>),
2322
}
2423

25-
/// A Secret Key that can be either a single key or an Xprv
24+
/// The descriptor secret key, either a single private key or an xprv.
2625
#[derive(Debug)]
2726
pub enum DescriptorSecretKey {
28-
/// Single Secret Key
27+
/// Single private key.
2928
SinglePriv(DescriptorSinglePriv),
30-
/// Xprv
29+
/// Extended private key (xpriv).
3130
XPrv(DescriptorXKey<bip32::ExtendedPrivKey>),
3231
}
3332

34-
/// A Single Descriptor Key with optional origin information
33+
/// A descriptor [`SinglePubKey`] with optional origin information.
3534
#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash)]
3635
pub struct DescriptorSinglePub {
37-
/// Origin information
36+
/// Origin information (fingerprint and derivation path).
3837
pub origin: Option<(bip32::Fingerprint, bip32::DerivationPath)>,
39-
/// The key
38+
/// The public key.
4039
pub key: SinglePubKey,
4140
}
4241

43-
/// A Single Descriptor Secret Key with optional origin information
42+
/// A descriptor [`bitcoin::PrivateKey`] with optional origin information.
4443
#[derive(Debug)]
4544
pub struct DescriptorSinglePriv {
46-
/// Origin information
45+
/// Origin information (fingerprint and derivation path).
4746
pub origin: Option<bip32::KeySource>,
48-
/// The key
47+
/// The private key.
4948
pub key: bitcoin::PrivateKey,
5049
}
5150

52-
/// Instance of an extended key with origin and derivation path
51+
/// An extended key with origin, derivation path, and wildcard.
5352
#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash)]
5453
pub struct DescriptorXKey<K: InnerXKey> {
5554
/// Origin information
@@ -62,12 +61,12 @@ pub struct DescriptorXKey<K: InnerXKey> {
6261
pub wildcard: Wildcard,
6362
}
6463

65-
/// Single public key without any origin or range information
64+
/// Single public key without any origin or range information.
6665
#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash)]
6766
pub enum SinglePubKey {
68-
/// FullKey (compressed or uncompressed)
67+
/// A bitcoin public key (compressed or uncompressed).
6968
FullKey(bitcoin::PublicKey),
70-
/// XOnlyPublicKey
69+
/// An xonly public key.
7170
XOnly(XOnlyPublicKey),
7271
}
7372

0 commit comments

Comments
 (0)