@@ -168,6 +168,18 @@ pub(crate) struct ConstructedTransaction {
168168 holder_sends_tx_signatures_first : bool ,
169169}
170170
171+ impl_writeable_tlv_based ! ( ConstructedTransaction , {
172+ ( 1 , holder_is_initiator, required) ,
173+ ( 3 , inputs, required) ,
174+ ( 5 , outputs, required) ,
175+ ( 7 , local_inputs_value_satoshis, required) ,
176+ ( 9 , local_outputs_value_satoshis, required) ,
177+ ( 11 , remote_inputs_value_satoshis, required) ,
178+ ( 13 , remote_outputs_value_satoshis, required) ,
179+ ( 15 , lock_time, required) ,
180+ ( 17 , holder_sends_tx_signatures_first, required) ,
181+ } ) ;
182+
171183impl ConstructedTransaction {
172184 fn new ( context : NegotiationContext ) -> Self {
173185 let local_inputs_value_satoshis = context
@@ -418,6 +430,13 @@ impl InteractiveTxSigningSession {
418430 }
419431}
420432
433+ impl_writeable_tlv_based ! ( InteractiveTxSigningSession , {
434+ ( 1 , unsigned_tx, required) ,
435+ ( 3 , holder_sends_tx_signatures_first, required) ,
436+ ( 5 , has_received_commitment_signed, required) ,
437+ ( 7 , holder_tx_signatures, required) ,
438+ } ) ;
439+
421440#[ derive( Debug ) ]
422441struct NegotiationContext {
423442 holder_node_id : PublicKey ,
@@ -1141,6 +1160,11 @@ enum AddingRole {
11411160 Remote ,
11421161}
11431162
1163+ impl_writeable_tlv_based_enum ! ( AddingRole ,
1164+ ( 1 , Local ) => { } ,
1165+ ( 3 , Remote ) => { } ,
1166+ ) ;
1167+
11441168/// Represents an input -- local or remote (both have the same fields)
11451169#[ derive( Clone , Debug , Eq , PartialEq ) ]
11461170pub struct LocalOrRemoteInput {
@@ -1149,19 +1173,35 @@ pub struct LocalOrRemoteInput {
11491173 prev_output : TxOut ,
11501174}
11511175
1176+ impl_writeable_tlv_based ! ( LocalOrRemoteInput , {
1177+ ( 1 , serial_id, required) ,
1178+ ( 3 , input, required) ,
1179+ ( 5 , prev_output, required) ,
1180+ } ) ;
1181+
11521182#[ derive( Clone , Debug , Eq , PartialEq ) ]
11531183pub ( crate ) enum InteractiveTxInput {
11541184 Local ( LocalOrRemoteInput ) ,
11551185 Remote ( LocalOrRemoteInput ) ,
11561186 // TODO(splicing) SharedInput should be added
11571187}
11581188
1189+ impl_writeable_tlv_based_enum ! ( InteractiveTxInput ,
1190+ { 1 , Local } => ( ) ,
1191+ { 3 , Remote } => ( ) ,
1192+ ) ;
1193+
11591194#[ derive( Clone , Debug , Eq , PartialEq ) ]
11601195pub struct SharedOwnedOutput {
11611196 tx_out : TxOut ,
11621197 local_owned : u64 ,
11631198}
11641199
1200+ impl_writeable_tlv_based ! ( SharedOwnedOutput , {
1201+ ( 1 , tx_out, required) ,
1202+ ( 3 , local_owned, required) ,
1203+ } ) ;
1204+
11651205impl SharedOwnedOutput {
11661206 fn new ( tx_out : TxOut , local_owned : u64 ) -> SharedOwnedOutput {
11671207 debug_assert ! (
@@ -1191,6 +1231,12 @@ pub enum OutputOwned {
11911231 Shared ( SharedOwnedOutput ) ,
11921232}
11931233
1234+ impl_writeable_tlv_based_enum ! ( OutputOwned ,
1235+ { 1 , Single } => ( ) ,
1236+ { 3 , SharedControlFullyOwned } => ( ) ,
1237+ { 5 , Shared } => ( ) ,
1238+ ) ;
1239+
11941240impl OutputOwned {
11951241 fn tx_out ( & self ) -> & TxOut {
11961242 match self {
@@ -1250,6 +1296,12 @@ pub(crate) struct InteractiveTxOutput {
12501296 output : OutputOwned ,
12511297}
12521298
1299+ impl_writeable_tlv_based ! ( InteractiveTxOutput , {
1300+ ( 1 , serial_id, required) ,
1301+ ( 3 , added_by, required) ,
1302+ ( 5 , output, required) ,
1303+ } ) ;
1304+
12531305impl InteractiveTxOutput {
12541306 pub fn tx_out ( & self ) -> & TxOut {
12551307 self . output . tx_out ( )
0 commit comments