@@ -189,6 +189,18 @@ pub(crate) struct ConstructedTransaction {
189189 holder_sends_tx_signatures_first : bool ,
190190}
191191
192+ impl_writeable_tlv_based ! ( ConstructedTransaction , {
193+ ( 1 , holder_is_initiator, required) ,
194+ ( 3 , inputs, required) ,
195+ ( 5 , outputs, required) ,
196+ ( 7 , local_inputs_value_satoshis, required) ,
197+ ( 9 , local_outputs_value_satoshis, required) ,
198+ ( 11 , remote_inputs_value_satoshis, required) ,
199+ ( 13 , remote_outputs_value_satoshis, required) ,
200+ ( 15 , lock_time, required) ,
201+ ( 17 , holder_sends_tx_signatures_first, required) ,
202+ } ) ;
203+
192204impl ConstructedTransaction {
193205 fn new ( context : NegotiationContext ) -> Self {
194206 let local_inputs_value_satoshis = context
@@ -439,6 +451,13 @@ impl InteractiveTxSigningSession {
439451 }
440452}
441453
454+ impl_writeable_tlv_based ! ( InteractiveTxSigningSession , {
455+ ( 1 , unsigned_tx, required) ,
456+ ( 3 , holder_sends_tx_signatures_first, required) ,
457+ ( 5 , has_received_commitment_signed, required) ,
458+ ( 7 , holder_tx_signatures, required) ,
459+ } ) ;
460+
442461#[ derive( Debug ) ]
443462struct NegotiationContext {
444463 holder_node_id : PublicKey ,
@@ -1162,6 +1181,11 @@ enum AddingRole {
11621181 Remote ,
11631182}
11641183
1184+ impl_writeable_tlv_based_enum ! ( AddingRole ,
1185+ ( 1 , Local ) => { } ,
1186+ ( 3 , Remote ) => { } ,
1187+ ) ;
1188+
11651189/// Represents an input -- local or remote (both have the same fields)
11661190#[ derive( Clone , Debug , Eq , PartialEq ) ]
11671191pub struct LocalOrRemoteInput {
@@ -1170,19 +1194,35 @@ pub struct LocalOrRemoteInput {
11701194 prev_output : TxOut ,
11711195}
11721196
1197+ impl_writeable_tlv_based ! ( LocalOrRemoteInput , {
1198+ ( 1 , serial_id, required) ,
1199+ ( 3 , input, required) ,
1200+ ( 5 , prev_output, required) ,
1201+ } ) ;
1202+
11731203#[ derive( Clone , Debug , Eq , PartialEq ) ]
11741204pub ( crate ) enum InteractiveTxInput {
11751205 Local ( LocalOrRemoteInput ) ,
11761206 Remote ( LocalOrRemoteInput ) ,
11771207 // TODO(splicing) SharedInput should be added
11781208}
11791209
1210+ impl_writeable_tlv_based_enum ! ( InteractiveTxInput ,
1211+ { 1 , Local } => ( ) ,
1212+ { 3 , Remote } => ( ) ,
1213+ ) ;
1214+
11801215#[ derive( Clone , Debug , Eq , PartialEq ) ]
11811216pub ( super ) struct SharedOwnedOutput {
11821217 tx_out : TxOut ,
11831218 local_owned : u64 ,
11841219}
11851220
1221+ impl_writeable_tlv_based ! ( SharedOwnedOutput , {
1222+ ( 1 , tx_out, required) ,
1223+ ( 3 , local_owned, required) ,
1224+ } ) ;
1225+
11861226impl SharedOwnedOutput {
11871227 pub fn new ( tx_out : TxOut , local_owned : u64 ) -> SharedOwnedOutput {
11881228 debug_assert ! (
@@ -1210,6 +1250,11 @@ pub(super) enum OutputOwned {
12101250 Shared ( SharedOwnedOutput ) ,
12111251}
12121252
1253+ impl_writeable_tlv_based_enum ! ( OutputOwned ,
1254+ { 1 , Single } => ( ) ,
1255+ { 3 , Shared } => ( ) ,
1256+ ) ;
1257+
12131258impl OutputOwned {
12141259 pub fn tx_out ( & self ) -> & TxOut {
12151260 match self {
@@ -1264,6 +1309,12 @@ pub(crate) struct InteractiveTxOutput {
12641309 output : OutputOwned ,
12651310}
12661311
1312+ impl_writeable_tlv_based ! ( InteractiveTxOutput , {
1313+ ( 1 , serial_id, required) ,
1314+ ( 3 , added_by, required) ,
1315+ ( 5 , output, required) ,
1316+ } ) ;
1317+
12671318impl InteractiveTxOutput {
12681319 pub fn tx_out ( & self ) -> & TxOut {
12691320 self . output . tx_out ( )
0 commit comments