Skip to content

Commit 1ef138f

Browse files
committed
Merge #353: Improve types struct and enum rustdocs
9a4e53c Improve types struct and enum rustdocs (Jamil Lambert, PhD) Pull request description: The rustdocs for the RPCs in types in inconsistent. In particular the sub structs and enums don't always mention which RPC they are part of. This makes it harder to understand which bit goes with which. Use the same language throughout so that when scanning through the code it is easier to follow. Make all the rustdocs consistent and mention which RPC they are part of. ACKs for top commit: tcharding: ACK 9a4e53c Tree-SHA512: 0f497179df047ff488e0edbfb9c2eb936c79e006d98285833d06ee988811fc8585e854880e6271e274d0d099e409986ebf272a618af96f7d41e2670876968afe
2 parents 2ddf47c + 9a4e53c commit 1ef138f

File tree

54 files changed

+190
-190
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+190
-190
lines changed

integration_test/tests/network.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn network__get_network_info__modelled() {
8181
let model: Result<mtype::GetNetworkInfo, GetNetworkInfoError> = json.into_model();
8282
model.unwrap();
8383

84-
// Server version is returned as part of the getnetworkinfo method.
84+
// Server version is part of the getnetworkinfo method.
8585
node.client.check_expected_server_version().expect("unexpected version");
8686
}
8787

types/src/model/blockchain.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pub struct GetBlockchainInfo {
135135
pub warnings: Vec<String>,
136136
}
137137

138-
/// Status of softfork.
138+
/// Softfork status. Part of `getblockchaininfo`.
139139
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
140140
#[serde(deny_unknown_fields)]
141141
pub struct Softfork {
@@ -150,7 +150,7 @@ pub struct Softfork {
150150
pub active: bool,
151151
}
152152

153-
/// The softfork type: one of "buried", "bip9".
153+
/// The softfork type. Part of `getblockchaininfo`.
154154
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
155155
#[serde(rename_all = "lowercase")]
156156
pub enum SoftforkType {
@@ -164,7 +164,7 @@ pub enum SoftforkType {
164164
Bip9,
165165
}
166166

167-
/// Status of BIP-9 softforks.
167+
/// BIP-9 softfork info. Part of `getblockchaininfo`.
168168
#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
169169
#[serde(deny_unknown_fields)]
170170
pub struct Bip9SoftforkInfo {
@@ -184,7 +184,7 @@ pub struct Bip9SoftforkInfo {
184184
pub statistics: Option<Bip9SoftforkStatistics>,
185185
}
186186

187-
/// BIP-9 softfork status: one of "defined", "started", "locked_in", "active", "failed".
187+
/// BIP-9 softfork status. Part of `getblockchaininfo`.
188188
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
189189
pub enum Bip9SoftforkStatus {
190190
/// BIP-9 softfork status "defined".
@@ -199,7 +199,7 @@ pub enum Bip9SoftforkStatus {
199199
Failed,
200200
}
201201

202-
/// Statistics for a BIP-9 softfork.
202+
/// BIP-9 softfork statistics. Part of `getblockchaininfo`.
203203
#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
204204
#[serde(deny_unknown_fields)]
205205
pub struct Bip9SoftforkStatistics {
@@ -356,7 +356,7 @@ pub struct GetChainStates {
356356
pub chain_states: Vec<ChainState>,
357357
}
358358

359-
/// A single chainstate returned as part of `getchainstates`.
359+
/// A single chainstate. Part of `getchainstates`.
360360
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
361361
#[serde(deny_unknown_fields)]
362362
pub struct ChainState {
@@ -401,7 +401,7 @@ pub struct ChainTips {
401401
pub status: ChainTipsStatus,
402402
}
403403

404-
/// The `status` field from an individual list item from the result of JSON-RPC method `getchaintips`.
404+
/// Chain tips status. Part of `getchaintips`.
405405
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
406406
#[serde(rename_all = "kebab-case")]
407407
pub enum ChainTipsStatus {
@@ -451,7 +451,7 @@ pub struct GetDeploymentInfo {
451451
pub deployments: std::collections::BTreeMap<String, DeploymentInfo>,
452452
}
453453

454-
/// Deployment info. Returned as part of `getdeploymentinfo`.
454+
/// Deployment info. Part of `getdeploymentinfo`.
455455
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
456456
#[serde(deny_unknown_fields)]
457457
pub struct DeploymentInfo {
@@ -465,7 +465,7 @@ pub struct DeploymentInfo {
465465
pub bip9: Option<Bip9Info>,
466466
}
467467

468-
/// Status of bip9 softforks. Returned as part of `getdeploymentinfo`.
468+
/// Status of bip9 softforks. Part of `getdeploymentinfo`.
469469
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
470470
#[serde(deny_unknown_fields)]
471471
pub struct Bip9Info {
@@ -489,7 +489,7 @@ pub struct Bip9Info {
489489
pub signalling: Option<String>,
490490
}
491491

492-
/// Numeric statistics about signalling for a softfork. Returned as part of `getdeploymentinfo`.
492+
/// Numeric statistics about signalling for a softfork. Part of `getdeploymentinfo`.
493493
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
494494
#[serde(deny_unknown_fields)]
495495
pub struct Bip9Statistics {
@@ -535,7 +535,7 @@ pub struct GetMempoolDescendantsVerbose(pub BTreeMap<Txid, MempoolEntry>);
535535
#[serde(deny_unknown_fields)]
536536
pub struct GetMempoolEntry(pub MempoolEntry);
537537

538-
/// A relative (ancestor or descendant) transaction of a transaction in the mempool.
538+
/// Mempool data. Part of `getmempoolentry`.
539539
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
540540
#[serde(deny_unknown_fields)]
541541
pub struct MempoolEntry {
@@ -565,7 +565,7 @@ pub struct MempoolEntry {
565565
pub ancestor_size: u32,
566566
/// Hash of serialized transaction, including witness data.
567567
pub wtxid: Wtxid,
568-
/// (No docs in Core v0.17.)
568+
/// (No docs in Core v0.17). Part of `getmempoolentry`.
569569
pub fees: MempoolEntryFees,
570570
/// Unconfirmed transactions used as inputs for this transaction (parent transaction id).
571571
pub depends: Vec<Txid>,
@@ -578,7 +578,7 @@ pub struct MempoolEntry {
578578
pub unbroadcast: Option<bool>,
579579
}
580580

581-
/// (No docs in Core v0.17.)
581+
/// Fee object. Part of `getmempoolentry`.
582582
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
583583
#[serde(deny_unknown_fields)]
584584
pub struct MempoolEntryFees {
@@ -686,7 +686,7 @@ pub struct GetTxOutSetInfo {
686686
#[serde(deny_unknown_fields)]
687687
pub struct GetTxSpendingPrevout(pub Vec<GetTxSpendingPrevoutItem>);
688688

689-
/// An individual result item from `gettxspendingprevout`.
689+
/// A transaction item. Part of `gettxspendingprevout`.
690690
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
691691
#[serde(deny_unknown_fields)]
692692
pub struct GetTxSpendingPrevoutItem {
@@ -709,7 +709,7 @@ pub struct GetDescriptorActivity {
709709
pub activity: Vec<ActivityEntry>,
710710
}
711711

712-
/// Enum representing either a spend or receive activity entry using model types.
712+
/// A spend or receive activity entry. Part of `getdescriptoractivity`.
713713
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
714714
pub enum ActivityEntry {
715715
/// The spend activity using `model::SpendActivity`.
@@ -718,7 +718,7 @@ pub enum ActivityEntry {
718718
Receive(ReceiveActivity),
719719
}
720720

721-
/// Models a 'spend' activity event with strongly typed fields.
721+
/// Models a 'spend' activity event. Part of `getdescriptoractivity`.
722722
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
723723
#[serde(deny_unknown_fields)]
724724
pub struct SpendActivity {
@@ -740,7 +740,7 @@ pub struct SpendActivity {
740740
pub prevout_spk: ScriptPubkey,
741741
}
742742

743-
/// Models a 'receive' activity event with strongly typed fields.
743+
/// Models a 'receive' activity event. Part of `getdescriptoractivity`
744744
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
745745
#[serde(deny_unknown_fields)]
746746
pub struct ReceiveActivity {
@@ -772,7 +772,7 @@ pub struct LoadTxOutSet {
772772
pub path: String,
773773
}
774774

775-
/// Models the result of the JSON-RPC method `scanblocks` start.
775+
/// Models the result of the JSON-RPC method `scanblocks` whan `action = start`.
776776
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
777777
pub struct ScanBlocksStart {
778778
/// The height we started the scan from

types/src/model/mining.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ pub struct GetBlockTemplate {
7070
pub default_witness_commitment: Option<String>,
7171
}
7272

73-
/// Contents of non-coinbase transactions that should be included in the next block.
74-
///
75-
/// Returned as part of `getblocktemplate`.
73+
/// Non-coinbase transaction contents. Part of `getblocktemplate`.
7674
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
7775
#[serde(deny_unknown_fields)]
7876
pub struct BlockTemplateTransaction {
@@ -132,7 +130,7 @@ pub struct GetMiningInfo {
132130
pub warnings: Vec<String>,
133131
}
134132

135-
/// Represents the `next` block information within the GetMiningInfo result.
133+
/// Represents the `next` block information. Part of `getmininginfo`.
136134
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
137135
#[serde(deny_unknown_fields)]
138136
pub struct NextBlockInfo {
@@ -151,6 +149,7 @@ pub struct NextBlockInfo {
151149
#[serde(deny_unknown_fields)]
152150
pub struct GetPrioritisedTransactions(pub BTreeMap<Txid, PrioritisedTransaction>);
153151

152+
/// An individual prioritised transaction. Part of `getprioritisedtransactions`.
154153
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
155154
#[serde(deny_unknown_fields)]
156155
pub struct PrioritisedTransaction {

types/src/model/network.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub struct GetNetworkInfo {
4646
pub warnings: Vec<String>,
4747
}
4848

49-
/// Part of the result of the JSON-RPC method `getnetworkinfo` (information per network).
49+
/// Information per network. Part of `getnetworkinfo`.
5050
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
5151
#[serde(deny_unknown_fields)]
5252
pub struct GetNetworkInfoNetwork {
@@ -62,7 +62,7 @@ pub struct GetNetworkInfoNetwork {
6262
pub proxy_randomize_credentials: bool,
6363
}
6464

65-
/// Part of the result of the JSON-RPC method `getnetworkinfo` (local address info).
65+
/// Local address info. Part of `getnetworkinfo`.
6666
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
6767
#[serde(deny_unknown_fields)]
6868
pub struct GetNetworkInfoAddress {

types/src/model/raw_transactions.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub struct AnalyzePsbt {
3030
pub next: String,
3131
}
3232

33-
/// Represents an input in a PSBT operation.
33+
/// An input in a PSBT operation. Part of `analyzepsbt`.
3434
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
3535
#[serde(deny_unknown_fields)]
3636
pub struct AnalyzePsbtInput {
@@ -44,7 +44,7 @@ pub struct AnalyzePsbtInput {
4444
pub next: Option<String>,
4545
}
4646

47-
/// Represents missing elements required to complete an input.
47+
/// Missing elements required to complete an input. Part of `analyzepsbt`.
4848
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
4949
#[serde(deny_unknown_fields)]
5050
pub struct AnalyzePsbtInputMissing {
@@ -202,7 +202,7 @@ pub struct SignRawTransaction {
202202
pub errors: Vec<SignFail>,
203203
}
204204

205-
/// Represents a script verification error.
205+
/// A script verification error. Part of `signrawtransaction`.
206206
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
207207
#[serde(deny_unknown_fields)]
208208
pub struct SignFail {
@@ -272,7 +272,7 @@ pub struct TestMempoolAccept {
272272
pub results: Vec<MempoolAcceptance>,
273273
}
274274

275-
/// Models a single mempool acceptance test result. Returned as part of `testmempoolaccept`.
275+
/// Models a single mempool acceptance test result. Part of `testmempoolaccept`.
276276
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
277277
#[serde(deny_unknown_fields)]
278278
pub struct MempoolAcceptance {
@@ -292,7 +292,7 @@ pub struct MempoolAcceptance {
292292
pub reject_details: Option<String>,
293293
}
294294

295-
/// Models the fees field. Returned as part of `testmempoolaccept`.
295+
/// Models the fees field. Part of `testmempoolaccept`.
296296
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
297297
#[serde(deny_unknown_fields)]
298298
pub struct MempoolAcceptanceFees {

0 commit comments

Comments
 (0)