@@ -53,13 +53,12 @@ pub type Psbt = PartiallySignedTransaction;
53
53
#[ derive( Debug , Clone , PartialEq , Eq ) ]
54
54
#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
55
55
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.
58
57
pub unsigned_tx : Transaction ,
59
58
/// The version number of this PSBT. If omitted, the version number is 0.
60
59
pub version : u32 ,
61
60
/// 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.
63
62
pub xpub : BTreeMap < ExtendedPubKey , KeySource > ,
64
63
/// Global proprietary key-value pairs.
65
64
#[ cfg_attr( feature = "serde" , serde( with = "crate::serde_utils::btreemap_as_seq_byte_values" ) ) ]
@@ -68,11 +67,9 @@ pub struct PartiallySignedTransaction {
68
67
#[ cfg_attr( feature = "serde" , serde( with = "crate::serde_utils::btreemap_as_seq_byte_values" ) ) ]
69
68
pub unknown : BTreeMap < raw:: Key , Vec < u8 > > ,
70
69
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.
73
71
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.
76
73
pub outputs : Vec < Output > ,
77
74
}
78
75
@@ -103,8 +100,7 @@ impl PartiallySignedTransaction {
103
100
} )
104
101
}
105
102
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.
108
104
fn unsigned_tx_checks ( & self ) -> Result < ( ) , Error > {
109
105
for txin in & self . unsigned_tx . input {
110
106
if !txin. script_sig . is_empty ( ) {
@@ -119,8 +115,11 @@ impl PartiallySignedTransaction {
119
115
Ok ( ( ) )
120
116
}
121
117
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.
124
123
pub fn from_unsigned_tx ( tx : Transaction ) -> Result < Self , Error > {
125
124
let psbt = PartiallySignedTransaction {
126
125
inputs : vec ! [ Default :: default ( ) ; tx. input. len( ) ] ,
@@ -136,8 +135,7 @@ impl PartiallySignedTransaction {
136
135
Ok ( psbt)
137
136
}
138
137
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.
141
139
pub fn extract_tx ( self ) -> Transaction {
142
140
let mut tx: Transaction = self . unsigned_tx ;
143
141
@@ -222,13 +220,13 @@ mod display_from_str {
222
220
use crate :: consensus:: encode:: { Error , self } ;
223
221
use base64:: display:: Base64Display ;
224
222
225
- /// Error happening during PSBT decoding from Base64 string
223
+ /// Error encountered during PSBT decoding from Base64 string.
226
224
#[ derive( Debug ) ]
227
225
#[ cfg_attr( docsrs, doc( cfg( feature = "base64" ) ) ) ]
228
226
pub enum PsbtParseError {
229
- /// Error in internal PSBT data structure
227
+ /// Error in internal PSBT data structure.
230
228
PsbtEncoding ( Error ) ,
231
- /// Error in PSBT Base64 encoding
229
+ /// Error in PSBT Base64 encoding.
232
230
Base64Encoding ( :: base64:: DecodeError )
233
231
}
234
232
0 commit comments