@@ -168,6 +168,18 @@ pub(crate) struct ConstructedTransaction {
168
168
holder_sends_tx_signatures_first : bool ,
169
169
}
170
170
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
+
171
183
impl ConstructedTransaction {
172
184
fn new ( context : NegotiationContext ) -> Self {
173
185
let local_inputs_value_satoshis = context
@@ -418,6 +430,13 @@ impl InteractiveTxSigningSession {
418
430
}
419
431
}
420
432
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
+
421
440
#[ derive( Debug ) ]
422
441
struct NegotiationContext {
423
442
holder_node_id : PublicKey ,
@@ -1141,6 +1160,11 @@ enum AddingRole {
1141
1160
Remote ,
1142
1161
}
1143
1162
1163
+ impl_writeable_tlv_based_enum ! ( AddingRole ,
1164
+ ( 1 , Local ) => { } ,
1165
+ ( 3 , Remote ) => { } ,
1166
+ ) ;
1167
+
1144
1168
/// Represents an input -- local or remote (both have the same fields)
1145
1169
#[ derive( Clone , Debug , Eq , PartialEq ) ]
1146
1170
pub struct LocalOrRemoteInput {
@@ -1149,19 +1173,35 @@ pub struct LocalOrRemoteInput {
1149
1173
prev_output : TxOut ,
1150
1174
}
1151
1175
1176
+ impl_writeable_tlv_based ! ( LocalOrRemoteInput , {
1177
+ ( 1 , serial_id, required) ,
1178
+ ( 3 , input, required) ,
1179
+ ( 5 , prev_output, required) ,
1180
+ } ) ;
1181
+
1152
1182
#[ derive( Clone , Debug , Eq , PartialEq ) ]
1153
1183
pub ( crate ) enum InteractiveTxInput {
1154
1184
Local ( LocalOrRemoteInput ) ,
1155
1185
Remote ( LocalOrRemoteInput ) ,
1156
1186
// TODO(splicing) SharedInput should be added
1157
1187
}
1158
1188
1189
+ impl_writeable_tlv_based_enum ! ( InteractiveTxInput ,
1190
+ { 1 , Local } => ( ) ,
1191
+ { 3 , Remote } => ( ) ,
1192
+ ) ;
1193
+
1159
1194
#[ derive( Clone , Debug , Eq , PartialEq ) ]
1160
1195
pub struct SharedOwnedOutput {
1161
1196
tx_out : TxOut ,
1162
1197
local_owned : u64 ,
1163
1198
}
1164
1199
1200
+ impl_writeable_tlv_based ! ( SharedOwnedOutput , {
1201
+ ( 1 , tx_out, required) ,
1202
+ ( 3 , local_owned, required) ,
1203
+ } ) ;
1204
+
1165
1205
impl SharedOwnedOutput {
1166
1206
fn new ( tx_out : TxOut , local_owned : u64 ) -> SharedOwnedOutput {
1167
1207
debug_assert ! (
@@ -1191,6 +1231,12 @@ pub enum OutputOwned {
1191
1231
Shared ( SharedOwnedOutput ) ,
1192
1232
}
1193
1233
1234
+ impl_writeable_tlv_based_enum ! ( OutputOwned ,
1235
+ { 1 , Single } => ( ) ,
1236
+ { 3 , SharedControlFullyOwned } => ( ) ,
1237
+ { 5 , Shared } => ( ) ,
1238
+ ) ;
1239
+
1194
1240
impl OutputOwned {
1195
1241
fn tx_out ( & self ) -> & TxOut {
1196
1242
match self {
@@ -1250,6 +1296,12 @@ pub(crate) struct InteractiveTxOutput {
1250
1296
output : OutputOwned ,
1251
1297
}
1252
1298
1299
+ impl_writeable_tlv_based ! ( InteractiveTxOutput , {
1300
+ ( 1 , serial_id, required) ,
1301
+ ( 3 , added_by, required) ,
1302
+ ( 5 , output, required) ,
1303
+ } ) ;
1304
+
1253
1305
impl InteractiveTxOutput {
1254
1306
pub fn tx_out ( & self ) -> & TxOut {
1255
1307
self . output . tx_out ( )
0 commit comments