Skip to content

Commit 645ab64

Browse files
author
ChallengeDev210
committed
Merge rust-bitcoin/rust-bitcoin#956: Improve docs in sighash and psbt/mod.rs
9896f27 psbt: Improve documentation (Tobin C. Harding) 33a5083 sighash: Improve documentation (Tobin Harding) Pull request description: Done while working on sighash and PSBT signing. Just the usual docs fixes. Note, does not do the whole `psbt` module just the file mentioned. ACKs for top commit: apoelstra: ACK 9896f27 Tree-SHA512: 5fbfa258cdb216189922a49a42b7ab9fb78faeee72d82f8cb99a1b3d930d170074013e317b0e7af259a404ac4db93841b4d2b525e933c5e145da71e7522800fd
2 parents 2d242b6 + 1faea44 commit 645ab64

File tree

2 files changed

+83
-83
lines changed

2 files changed

+83
-83
lines changed

src/util/psbt/mod.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@ pub type Psbt = PartiallySignedTransaction;
5353
#[derive(Debug, Clone, PartialEq, Eq)]
5454
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5555
pub struct PartiallySignedTransaction {
56-
/// The unsigned transaction, scriptSigs and witnesses for each input must be
57-
/// empty.
56+
/// The unsigned transaction, scriptSigs and witnesses for each input must be empty.
5857
pub unsigned_tx: Transaction,
5958
/// The version number of this PSBT. If omitted, the version number is 0.
6059
pub version: u32,
6160
/// A global map from extended public keys to the used key fingerprint and
62-
/// derivation path as defined by BIP 32
61+
/// derivation path as defined by BIP 32.
6362
pub xpub: BTreeMap<ExtendedPubKey, KeySource>,
6463
/// Global proprietary key-value pairs.
6564
#[cfg_attr(feature = "serde", serde(with = "crate::serde_utils::btreemap_as_seq_byte_values"))]
@@ -68,11 +67,9 @@ pub struct PartiallySignedTransaction {
6867
#[cfg_attr(feature = "serde", serde(with = "crate::serde_utils::btreemap_as_seq_byte_values"))]
6968
pub unknown: BTreeMap<raw::Key, Vec<u8>>,
7069

71-
/// The corresponding key-value map for each input in the unsigned
72-
/// transaction.
70+
/// The corresponding key-value map for each input in the unsigned transaction.
7371
pub inputs: Vec<Input>,
74-
/// The corresponding key-value map for each output in the unsigned
75-
/// transaction.
72+
/// The corresponding key-value map for each output in the unsigned transaction.
7673
pub outputs: Vec<Output>,
7774
}
7875

@@ -103,8 +100,7 @@ impl PartiallySignedTransaction {
103100
})
104101
}
105102

106-
/// Checks that unsigned transaction does not have scriptSig's or witness
107-
/// data
103+
/// Checks that unsigned transaction does not have scriptSig's or witness data.
108104
fn unsigned_tx_checks(&self) -> Result<(), Error> {
109105
for txin in &self.unsigned_tx.input {
110106
if !txin.script_sig.is_empty() {
@@ -119,8 +115,11 @@ impl PartiallySignedTransaction {
119115
Ok(())
120116
}
121117

122-
/// Create a PartiallySignedTransaction from an unsigned transaction, error
123-
/// if not unsigned
118+
/// Creates a PSBT from an unsigned transaction.
119+
///
120+
/// # Errors
121+
///
122+
/// If transactions is not unsigned.
124123
pub fn from_unsigned_tx(tx: Transaction) -> Result<Self, Error> {
125124
let psbt = PartiallySignedTransaction {
126125
inputs: vec![Default::default(); tx.input.len()],
@@ -136,8 +135,7 @@ impl PartiallySignedTransaction {
136135
Ok(psbt)
137136
}
138137

139-
/// Extract the Transaction from a PartiallySignedTransaction by filling in
140-
/// the available signature information in place.
138+
/// Extracts the `Transaction` from a PSBT by filling in the available signature information.
141139
pub fn extract_tx(self) -> Transaction {
142140
let mut tx: Transaction = self.unsigned_tx;
143141

@@ -222,13 +220,13 @@ mod display_from_str {
222220
use crate::consensus::encode::{Error, self};
223221
use base64::display::Base64Display;
224222

225-
/// Error happening during PSBT decoding from Base64 string
223+
/// Error encountered during PSBT decoding from Base64 string.
226224
#[derive(Debug)]
227225
#[cfg_attr(docsrs, doc(cfg(feature = "base64")))]
228226
pub enum PsbtParseError {
229-
/// Error in internal PSBT data structure
227+
/// Error in internal PSBT data structure.
230228
PsbtEncoding(Error),
231-
/// Error in PSBT Base64 encoding
229+
/// Error in PSBT Base64 encoding.
232230
Base64Encoding(::base64::DecodeError)
233231
}
234232

0 commit comments

Comments
 (0)