@@ -90,13 +90,6 @@ impl SerialIdExt for SerialId {
9090 }
9191}
9292
93- #[ derive( Clone , Debug ) ]
94- pub ( crate ) struct NegotiationError {
95- pub reason : AbortReason ,
96- pub contributed_inputs : Vec < BitcoinOutPoint > ,
97- pub contributed_outputs : Vec < TxOut > ,
98- }
99-
10093#[ derive( Debug , Clone , Copy , PartialEq ) ]
10194pub ( crate ) enum AbortReason {
10295 InvalidStateTransition ,
@@ -370,11 +363,6 @@ impl ConstructedTransaction {
370363 Ok ( tx)
371364 }
372365
373- fn into_negotiation_error ( self , reason : AbortReason ) -> NegotiationError {
374- let ( contributed_inputs, contributed_outputs) = self . into_contributed_inputs_and_outputs ( ) ;
375- NegotiationError { reason, contributed_inputs, contributed_outputs }
376- }
377-
378366 fn contributed_inputs ( & self ) -> impl Iterator < Item = BitcoinOutPoint > + ' _ {
379367 self . tx
380368 . input
@@ -401,40 +389,6 @@ impl ConstructedTransaction {
401389 . map ( |( _, ( txout, _) ) | txout)
402390 }
403391
404- fn to_contributed_inputs_and_outputs ( & self ) -> ( Vec < BitcoinOutPoint > , Vec < TxOut > ) {
405- ( self . contributed_inputs ( ) . collect ( ) , self . contributed_outputs ( ) . cloned ( ) . collect ( ) )
406- }
407-
408- fn into_contributed_inputs_and_outputs ( self ) -> ( Vec < BitcoinOutPoint > , Vec < TxOut > ) {
409- let contributed_inputs = self
410- . tx
411- . input
412- . into_iter ( )
413- . zip ( self . input_metadata . iter ( ) )
414- . enumerate ( )
415- . filter ( |( _, ( _, input) ) | input. is_local ( self . holder_is_initiator ) )
416- . filter ( |( index, _) | {
417- self . shared_input_index
418- . map ( |shared_index| * index != shared_index as usize )
419- . unwrap_or ( true )
420- } )
421- . map ( |( _, ( txin, _) ) | txin. previous_output )
422- . collect ( ) ;
423-
424- let contributed_outputs = self
425- . tx
426- . output
427- . into_iter ( )
428- . zip ( self . output_metadata . iter ( ) )
429- . enumerate ( )
430- . filter ( |( _, ( _, output) ) | output. is_local ( self . holder_is_initiator ) )
431- . filter ( |( index, _) | * index != self . shared_output_index as usize )
432- . map ( |( _, ( txout, _) ) | txout)
433- . collect ( ) ;
434-
435- ( contributed_inputs, contributed_outputs)
436- }
437-
438392 pub fn tx ( & self ) -> & Transaction {
439393 & self . tx
440394 }
@@ -921,25 +875,13 @@ impl InteractiveTxSigningSession {
921875 Ok ( ( ) )
922876 }
923877
924- pub ( crate ) fn into_negotiation_error ( self , reason : AbortReason ) -> NegotiationError {
925- self . unsigned_tx . into_negotiation_error ( reason)
926- }
927-
928878 pub ( super ) fn contributed_inputs ( & self ) -> impl Iterator < Item = BitcoinOutPoint > + ' _ {
929879 self . unsigned_tx . contributed_inputs ( )
930880 }
931881
932882 pub ( super ) fn contributed_outputs ( & self ) -> impl Iterator < Item = & TxOut > + ' _ {
933883 self . unsigned_tx . contributed_outputs ( )
934884 }
935-
936- pub ( super ) fn to_contributed_inputs_and_outputs ( & self ) -> ( Vec < BitcoinOutPoint > , Vec < TxOut > ) {
937- ( self . contributed_inputs ( ) . collect ( ) , self . contributed_outputs ( ) . cloned ( ) . collect ( ) )
938- }
939-
940- pub ( super ) fn into_contributed_inputs_and_outputs ( self ) -> ( Vec < BitcoinOutPoint > , Vec < TxOut > ) {
941- self . unsigned_tx . into_contributed_inputs_and_outputs ( )
942- }
943885}
944886
945887impl_writeable_tlv_based ! ( InteractiveTxSigningSession , {
@@ -2172,27 +2114,6 @@ impl InteractiveTxConstructor {
21722114 Self :: new ( args, false )
21732115 }
21742116
2175- fn into_negotiation_error ( self , reason : AbortReason ) -> NegotiationError {
2176- let ( contributed_inputs, contributed_outputs) = self . into_contributed_inputs_and_outputs ( ) ;
2177- NegotiationError { reason, contributed_inputs, contributed_outputs }
2178- }
2179-
2180- pub ( super ) fn into_contributed_inputs_and_outputs ( self ) -> ( Vec < BitcoinOutPoint > , Vec < TxOut > ) {
2181- let contributed_inputs = self
2182- . inputs_to_contribute
2183- . into_iter ( )
2184- . filter ( |( _, input) | !input. is_shared ( ) )
2185- . map ( |( _, input) | input. into_tx_in ( ) . previous_output )
2186- . collect ( ) ;
2187- let contributed_outputs = self
2188- . outputs_to_contribute
2189- . into_iter ( )
2190- . filter ( |( _, output) | !output. is_shared ( ) )
2191- . map ( |( _, output) | output. into_tx_out ( ) )
2192- . collect ( ) ;
2193- ( contributed_inputs, contributed_outputs)
2194- }
2195-
21962117 pub ( super ) fn contributed_inputs ( & self ) -> impl Iterator < Item = BitcoinOutPoint > + ' _ {
21972118 self . inputs_to_contribute
21982119 . iter ( )
@@ -2207,10 +2128,6 @@ impl InteractiveTxConstructor {
22072128 . map ( |( _, output) | output. tx_out ( ) )
22082129 }
22092130
2210- pub ( super ) fn to_contributed_inputs_and_outputs ( & self ) -> ( Vec < BitcoinOutPoint > , Vec < TxOut > ) {
2211- ( self . contributed_inputs ( ) . collect ( ) , self . contributed_outputs ( ) . cloned ( ) . collect ( ) )
2212- }
2213-
22142131 pub fn is_initiator ( & self ) -> bool {
22152132 self . is_initiator
22162133 }
0 commit comments