@@ -189,6 +189,18 @@ pub(crate) struct ConstructedTransaction {
189
189
holder_sends_tx_signatures_first : bool ,
190
190
}
191
191
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
+
192
204
impl ConstructedTransaction {
193
205
fn new ( context : NegotiationContext ) -> Self {
194
206
let local_inputs_value_satoshis = context
@@ -439,6 +451,13 @@ impl InteractiveTxSigningSession {
439
451
}
440
452
}
441
453
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
+
442
461
#[ derive( Debug ) ]
443
462
struct NegotiationContext {
444
463
holder_node_id : PublicKey ,
@@ -1162,6 +1181,11 @@ enum AddingRole {
1162
1181
Remote ,
1163
1182
}
1164
1183
1184
+ impl_writeable_tlv_based_enum ! ( AddingRole ,
1185
+ ( 1 , Local ) => { } ,
1186
+ ( 3 , Remote ) => { } ,
1187
+ ) ;
1188
+
1165
1189
/// Represents an input -- local or remote (both have the same fields)
1166
1190
#[ derive( Clone , Debug , Eq , PartialEq ) ]
1167
1191
pub struct LocalOrRemoteInput {
@@ -1170,19 +1194,35 @@ pub struct LocalOrRemoteInput {
1170
1194
prev_output : TxOut ,
1171
1195
}
1172
1196
1197
+ impl_writeable_tlv_based ! ( LocalOrRemoteInput , {
1198
+ ( 1 , serial_id, required) ,
1199
+ ( 3 , input, required) ,
1200
+ ( 5 , prev_output, required) ,
1201
+ } ) ;
1202
+
1173
1203
#[ derive( Clone , Debug , Eq , PartialEq ) ]
1174
1204
pub ( crate ) enum InteractiveTxInput {
1175
1205
Local ( LocalOrRemoteInput ) ,
1176
1206
Remote ( LocalOrRemoteInput ) ,
1177
1207
// TODO(splicing) SharedInput should be added
1178
1208
}
1179
1209
1210
+ impl_writeable_tlv_based_enum ! ( InteractiveTxInput ,
1211
+ { 1 , Local } => ( ) ,
1212
+ { 3 , Remote } => ( ) ,
1213
+ ) ;
1214
+
1180
1215
#[ derive( Clone , Debug , Eq , PartialEq ) ]
1181
1216
pub ( super ) struct SharedOwnedOutput {
1182
1217
tx_out : TxOut ,
1183
1218
local_owned : u64 ,
1184
1219
}
1185
1220
1221
+ impl_writeable_tlv_based ! ( SharedOwnedOutput , {
1222
+ ( 1 , tx_out, required) ,
1223
+ ( 3 , local_owned, required) ,
1224
+ } ) ;
1225
+
1186
1226
impl SharedOwnedOutput {
1187
1227
pub fn new ( tx_out : TxOut , local_owned : u64 ) -> SharedOwnedOutput {
1188
1228
debug_assert ! (
@@ -1210,6 +1250,11 @@ pub(super) enum OutputOwned {
1210
1250
Shared ( SharedOwnedOutput ) ,
1211
1251
}
1212
1252
1253
+ impl_writeable_tlv_based_enum ! ( OutputOwned ,
1254
+ { 1 , Single } => ( ) ,
1255
+ { 3 , Shared } => ( ) ,
1256
+ ) ;
1257
+
1213
1258
impl OutputOwned {
1214
1259
pub fn tx_out ( & self ) -> & TxOut {
1215
1260
match self {
@@ -1264,6 +1309,12 @@ pub(crate) struct InteractiveTxOutput {
1264
1309
output : OutputOwned ,
1265
1310
}
1266
1311
1312
+ impl_writeable_tlv_based ! ( InteractiveTxOutput , {
1313
+ ( 1 , serial_id, required) ,
1314
+ ( 3 , added_by, required) ,
1315
+ ( 5 , output, required) ,
1316
+ } ) ;
1317
+
1267
1318
impl InteractiveTxOutput {
1268
1319
pub fn tx_out ( & self ) -> & TxOut {
1269
1320
self . output . tx_out ( )
0 commit comments