@@ -198,7 +198,7 @@ impl Display for AbortReason {
198198pub ( crate ) struct ConstructedTransaction {
199199 holder_is_initiator : bool ,
200200
201- inputs : Vec < NegotiatedTxInput > ,
201+ input_metadata : Vec < TxInMetadata > ,
202202 outputs : Vec < InteractiveTxOutput > ,
203203 tx : Transaction ,
204204
@@ -212,12 +212,12 @@ pub(crate) struct ConstructedTransaction {
212212}
213213
214214#[ derive( Clone , Debug , Eq , PartialEq ) ]
215- pub ( crate ) struct NegotiatedTxInput {
215+ pub ( crate ) struct TxInMetadata {
216216 serial_id : SerialId ,
217217 prev_output : TxOut ,
218218}
219219
220- impl NegotiatedTxInput {
220+ impl TxInMetadata {
221221 pub ( super ) fn is_local ( & self , holder_is_initiator : bool ) -> bool {
222222 !is_serial_id_valid_for_counterparty ( holder_is_initiator, self . serial_id )
223223 }
@@ -227,14 +227,14 @@ impl NegotiatedTxInput {
227227 }
228228}
229229
230- impl_writeable_tlv_based ! ( NegotiatedTxInput , {
230+ impl_writeable_tlv_based ! ( TxInMetadata , {
231231 ( 1 , serial_id, required) ,
232232 ( 3 , prev_output, required) ,
233233} ) ;
234234
235235impl_writeable_tlv_based ! ( ConstructedTransaction , {
236236 ( 1 , holder_is_initiator, required) ,
237- ( 3 , inputs , required) ,
237+ ( 3 , input_metadata , required) ,
238238 ( 5 , outputs, required) ,
239239 ( 7 , tx, required) ,
240240 ( 9 , local_inputs_value_satoshis, required) ,
@@ -279,11 +279,8 @@ impl ConstructedTransaction {
279279 value. saturating_add ( input. satisfaction_weight ( ) . to_wu ( ) )
280280 } ) ) ;
281281
282- let mut inputs: Vec < ( TxIn , NegotiatedTxInput ) > = context
283- . inputs
284- . into_values ( )
285- . map ( |input| input. into_txin_and_negotiated_input ( ) )
286- . collect ( ) ;
282+ let mut inputs: Vec < ( TxIn , TxInMetadata ) > =
283+ context. inputs . into_values ( ) . map ( |input| input. into_txin_and_metadata ( ) ) . collect ( ) ;
287284 let mut outputs: Vec < InteractiveTxOutput > = context. outputs . into_values ( ) . collect ( ) ;
288285 inputs. sort_unstable_by_key ( |( _, input) | input. serial_id ) ;
289286 outputs. sort_unstable_by_key ( |output| output. serial_id ) ;
@@ -298,7 +295,7 @@ impl ConstructedTransaction {
298295 . map ( |position| position as u32 )
299296 } ) ;
300297
301- let ( input, inputs ) : ( Vec < TxIn > , Vec < NegotiatedTxInput > ) = inputs. into_iter ( ) . unzip ( ) ;
298+ let ( input, input_metadata ) : ( Vec < TxIn > , Vec < TxInMetadata > ) = inputs. into_iter ( ) . unzip ( ) ;
302299 let output = outputs. iter ( ) . map ( |output| output. tx_out ( ) . clone ( ) ) . collect ( ) ;
303300
304301 let tx =
@@ -318,7 +315,7 @@ impl ConstructedTransaction {
318315 remote_inputs_value_satoshis,
319316 remote_outputs_value_satoshis,
320317
321- inputs ,
318+ input_metadata ,
322319 outputs,
323320 tx,
324321
@@ -334,8 +331,8 @@ impl ConstructedTransaction {
334331 self . outputs . iter ( )
335332 }
336333
337- pub fn inputs ( & self ) -> impl Iterator < Item = & NegotiatedTxInput > {
338- self . inputs . iter ( )
334+ pub fn input_metadata ( & self ) -> impl Iterator < Item = & TxInMetadata > {
335+ self . input_metadata . iter ( )
339336 }
340337
341338 pub fn compute_txid ( & self ) -> Txid {
@@ -349,7 +346,7 @@ impl ConstructedTransaction {
349346 self . tx
350347 . input
351348 . iter_mut ( )
352- . zip ( self . inputs . iter ( ) )
349+ . zip ( self . input_metadata . iter ( ) )
353350 . enumerate ( )
354351 . filter ( |( _, ( _, input) ) | input. is_local ( self . holder_is_initiator ) )
355352 . filter ( |( index, _) | {
@@ -369,7 +366,7 @@ impl ConstructedTransaction {
369366 self . tx
370367 . input
371368 . iter_mut ( )
372- . zip ( self . inputs . iter ( ) )
369+ . zip ( self . input_metadata . iter ( ) )
373370 . enumerate ( )
374371 . filter ( |( _, ( _, input) ) | !input. is_local ( self . holder_is_initiator ) )
375372 . filter ( |( index, _) | {
@@ -535,7 +532,7 @@ impl InteractiveTxSigningSession {
535532 pub fn remote_inputs_count ( & self ) -> usize {
536533 let shared_index = self . unsigned_tx . shared_input_index . as_ref ( ) ;
537534 self . unsigned_tx
538- . inputs
535+ . input_metadata
539536 . iter ( )
540537 . enumerate ( )
541538 . filter ( |( _, input) | !input. is_local ( self . unsigned_tx . holder_is_initiator ) )
@@ -547,7 +544,7 @@ impl InteractiveTxSigningSession {
547544
548545 pub fn local_inputs_count ( & self ) -> usize {
549546 self . unsigned_tx
550- . inputs
547+ . input_metadata
551548 . iter ( )
552549 . enumerate ( )
553550 . filter ( |( _, input) | input. is_local ( self . unsigned_tx . holder_is_initiator ) )
@@ -578,10 +575,10 @@ impl InteractiveTxSigningSession {
578575 self . local_inputs_count ( ) > 0 || self . local_outputs_count ( ) > 0
579576 }
580577
581- pub fn shared_input ( & self ) -> Option < & NegotiatedTxInput > {
582- self . unsigned_tx
583- . shared_input_index
584- . and_then ( |shared_input_index| self . unsigned_tx . inputs . get ( shared_input_index as usize ) )
578+ pub fn shared_input ( & self ) -> Option < & TxInMetadata > {
579+ self . unsigned_tx . shared_input_index . and_then ( |shared_input_index| {
580+ self . unsigned_tx . input_metadata . get ( shared_input_index as usize )
581+ } )
585582 }
586583
587584 fn finalize_funding_tx ( & mut self ) -> Transaction {
@@ -629,13 +626,13 @@ impl InteractiveTxSigningSession {
629626 let unsigned_tx = self . unsigned_tx ( ) ;
630627 let built_tx = unsigned_tx. tx ( ) ;
631628 let prev_outputs: Vec < & TxOut > =
632- unsigned_tx. inputs ( ) . map ( |input| input. prev_output ( ) ) . collect :: < Vec < _ > > ( ) ;
629+ unsigned_tx. input_metadata ( ) . map ( |input| input. prev_output ( ) ) . collect :: < Vec < _ > > ( ) ;
633630 let all_prevouts = sighash:: Prevouts :: All ( & prev_outputs[ ..] ) ;
634631
635632 let mut cache = SighashCache :: new ( built_tx) ;
636633
637634 let script_pubkeys = unsigned_tx
638- . inputs ( )
635+ . input_metadata ( )
639636 . enumerate ( )
640637 . filter ( |( _, input) | input. is_local ( unsigned_tx. holder_is_initiator ( ) ) )
641638 . filter ( |( index, _) | {
@@ -1835,9 +1832,9 @@ impl InteractiveTxInput {
18351832 self . input . satisfaction_weight ( )
18361833 }
18371834
1838- fn into_txin_and_negotiated_input ( self ) -> ( TxIn , NegotiatedTxInput ) {
1835+ fn into_txin_and_metadata ( self ) -> ( TxIn , TxInMetadata ) {
18391836 let ( txin, prev_output) = self . input . into_tx_in_with_prev_output ( ) ;
1840- ( txin, NegotiatedTxInput { serial_id : self . serial_id , prev_output } )
1837+ ( txin, TxInMetadata { serial_id : self . serial_id , prev_output } )
18411838 }
18421839}
18431840
@@ -2228,7 +2225,7 @@ mod tests {
22282225
22292226 use super :: {
22302227 get_output_weight, AddingRole , ConstructedTransaction , InteractiveTxOutput ,
2231- InteractiveTxSigningSession , NegotiatedTxInput , OutputOwned , P2TR_INPUT_WEIGHT_LOWER_BOUND ,
2228+ InteractiveTxSigningSession , OutputOwned , TxInMetadata , P2TR_INPUT_WEIGHT_LOWER_BOUND ,
22322229 P2WPKH_INPUT_WEIGHT_LOWER_BOUND , P2WSH_INPUT_WEIGHT_LOWER_BOUND , TX_COMMON_FIELDS_WEIGHT ,
22332230 } ;
22342231
@@ -3301,11 +3298,11 @@ mod tests {
33013298 fn do_verify_tx_signatures (
33023299 transaction : Transaction , prev_outputs : Vec < TxOut > ,
33033300 ) -> Result < ( ) , String > {
3304- let inputs : Vec < NegotiatedTxInput > = prev_outputs
3301+ let input_metadata : Vec < TxInMetadata > = prev_outputs
33053302 . into_iter ( )
33063303 . enumerate ( )
33073304 . map ( |( idx, prev_output) | {
3308- NegotiatedTxInput {
3305+ TxInMetadata {
33093306 serial_id : idx as u64 , // even values will be holder (initiator in this test)
33103307 prev_output,
33113308 }
@@ -3325,7 +3322,7 @@ mod tests {
33253322
33263323 let unsigned_tx = ConstructedTransaction {
33273324 holder_is_initiator : true ,
3328- inputs ,
3325+ input_metadata ,
33293326 outputs,
33303327 tx : transaction. clone ( ) ,
33313328 local_inputs_value_satoshis : 0 , // N/A for test
0 commit comments