@@ -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 }
@@ -909,25 +863,13 @@ impl InteractiveTxSigningSession {
909863 Ok ( ( ) )
910864 }
911865
912- pub ( crate ) fn into_negotiation_error ( self , reason : AbortReason ) -> NegotiationError {
913- self . unsigned_tx . into_negotiation_error ( reason)
914- }
915-
916866 pub ( super ) fn contributed_inputs ( & self ) -> impl Iterator < Item = BitcoinOutPoint > + ' _ {
917867 self . unsigned_tx . contributed_inputs ( )
918868 }
919869
920870 pub ( super ) fn contributed_outputs ( & self ) -> impl Iterator < Item = & TxOut > + ' _ {
921871 self . unsigned_tx . contributed_outputs ( )
922872 }
923-
924- pub ( super ) fn to_contributed_inputs_and_outputs ( & self ) -> ( Vec < BitcoinOutPoint > , Vec < TxOut > ) {
925- ( self . contributed_inputs ( ) . collect ( ) , self . contributed_outputs ( ) . cloned ( ) . collect ( ) )
926- }
927-
928- pub ( super ) fn into_contributed_inputs_and_outputs ( self ) -> ( Vec < BitcoinOutPoint > , Vec < TxOut > ) {
929- self . unsigned_tx . into_contributed_inputs_and_outputs ( )
930- }
931873}
932874
933875impl_writeable_tlv_based ! ( InteractiveTxSigningSession , {
@@ -2160,27 +2102,6 @@ impl InteractiveTxConstructor {
21602102 Self :: new ( args, false )
21612103 }
21622104
2163- fn into_negotiation_error ( self , reason : AbortReason ) -> NegotiationError {
2164- let ( contributed_inputs, contributed_outputs) = self . into_contributed_inputs_and_outputs ( ) ;
2165- NegotiationError { reason, contributed_inputs, contributed_outputs }
2166- }
2167-
2168- pub ( super ) fn into_contributed_inputs_and_outputs ( self ) -> ( Vec < BitcoinOutPoint > , Vec < TxOut > ) {
2169- let contributed_inputs = self
2170- . inputs_to_contribute
2171- . into_iter ( )
2172- . filter ( |( _, input) | !input. is_shared ( ) )
2173- . map ( |( _, input) | input. into_tx_in ( ) . previous_output )
2174- . collect ( ) ;
2175- let contributed_outputs = self
2176- . outputs_to_contribute
2177- . into_iter ( )
2178- . filter ( |( _, output) | !output. is_shared ( ) )
2179- . map ( |( _, output) | output. into_tx_out ( ) )
2180- . collect ( ) ;
2181- ( contributed_inputs, contributed_outputs)
2182- }
2183-
21842105 pub ( super ) fn contributed_inputs ( & self ) -> impl Iterator < Item = BitcoinOutPoint > + ' _ {
21852106 self . inputs_to_contribute
21862107 . iter ( )
@@ -2195,10 +2116,6 @@ impl InteractiveTxConstructor {
21952116 . map ( |( _, output) | output. tx_out ( ) )
21962117 }
21972118
2198- pub ( super ) fn to_contributed_inputs_and_outputs ( & self ) -> ( Vec < BitcoinOutPoint > , Vec < TxOut > ) {
2199- ( self . contributed_inputs ( ) . collect ( ) , self . contributed_outputs ( ) . cloned ( ) . collect ( ) )
2200- }
2201-
22022119 pub fn is_initiator ( & self ) -> bool {
22032120 self . is_initiator
22042121 }
0 commit comments