@@ -95,7 +95,7 @@ impl Writeable for ChannelMonitorUpdate {
95
95
for update_step in self . updates . iter ( ) {
96
96
update_step. write ( w) ?;
97
97
}
98
- write_tlv_fields ! ( w, { } , { } ) ;
98
+ write_tlv_fields ! ( w, { } ) ;
99
99
Ok ( ( ) )
100
100
}
101
101
}
@@ -108,7 +108,7 @@ impl Readable for ChannelMonitorUpdate {
108
108
for _ in 0 ..len {
109
109
updates. push ( Readable :: read ( r) ?) ;
110
110
}
111
- read_tlv_fields ! ( r, { } , { } ) ;
111
+ read_tlv_fields ! ( r, { } ) ;
112
112
Ok ( Self { update_id, updates } )
113
113
}
114
114
}
@@ -202,11 +202,10 @@ pub struct HTLCUpdate {
202
202
pub ( crate ) source : HTLCSource
203
203
}
204
204
impl_writeable_tlv_based ! ( HTLCUpdate , {
205
- ( 0 , payment_hash) ,
206
- ( 2 , source) ,
207
- } , {
208
- ( 4 , payment_preimage)
209
- } , { } ) ;
205
+ ( 0 , payment_hash, required) ,
206
+ ( 2 , source, required) ,
207
+ ( 4 , payment_preimage, option) ,
208
+ } ) ;
210
209
211
210
/// If an HTLC expires within this many blocks, don't try to claim it in a shared transaction,
212
211
/// instead claiming it in its own individual transaction.
@@ -273,15 +272,14 @@ struct HolderSignedTx {
273
272
htlc_outputs : Vec < ( HTLCOutputInCommitment , Option < Signature > , Option < HTLCSource > ) > ,
274
273
}
275
274
impl_writeable_tlv_based ! ( HolderSignedTx , {
276
- ( 0 , txid) ,
277
- ( 2 , revocation_key) ,
278
- ( 4 , a_htlc_key) ,
279
- ( 6 , b_htlc_key) ,
280
- ( 8 , delayed_payment_key) ,
281
- ( 10 , per_commitment_point) ,
282
- ( 12 , feerate_per_kw) ,
283
- } , { } , {
284
- ( 14 , htlc_outputs)
275
+ ( 0 , txid, required) ,
276
+ ( 2 , revocation_key, required) ,
277
+ ( 4 , a_htlc_key, required) ,
278
+ ( 6 , b_htlc_key, required) ,
279
+ ( 8 , delayed_payment_key, required) ,
280
+ ( 10 , per_commitment_point, required) ,
281
+ ( 12 , feerate_per_kw, required) ,
282
+ ( 14 , htlc_outputs, vec_type)
285
283
} ) ;
286
284
287
285
/// We use this to track counterparty commitment transactions and htlcs outputs and
@@ -305,10 +303,10 @@ impl Writeable for CounterpartyCommitmentTransaction {
305
303
}
306
304
}
307
305
write_tlv_fields ! ( w, {
308
- ( 0 , self . counterparty_delayed_payment_base_key) ,
309
- ( 2 , self . counterparty_htlc_base_key) ,
310
- ( 4 , self . on_counterparty_tx_csv) ,
311
- } , { } ) ;
306
+ ( 0 , self . counterparty_delayed_payment_base_key, required ) ,
307
+ ( 2 , self . counterparty_htlc_base_key, required ) ,
308
+ ( 4 , self . on_counterparty_tx_csv, required ) ,
309
+ } ) ;
312
310
Ok ( ( ) )
313
311
}
314
312
}
@@ -333,10 +331,10 @@ impl Readable for CounterpartyCommitmentTransaction {
333
331
let mut counterparty_htlc_base_key = OptionDeserWrapper ( None ) ;
334
332
let mut on_counterparty_tx_csv: u16 = 0 ;
335
333
read_tlv_fields ! ( r, {
336
- ( 0 , counterparty_delayed_payment_base_key) ,
337
- ( 2 , counterparty_htlc_base_key) ,
338
- ( 4 , on_counterparty_tx_csv) ,
339
- } , { } ) ;
334
+ ( 0 , counterparty_delayed_payment_base_key, required ) ,
335
+ ( 2 , counterparty_htlc_base_key, required ) ,
336
+ ( 4 , on_counterparty_tx_csv, required ) ,
337
+ } ) ;
340
338
CounterpartyCommitmentTransaction {
341
339
counterparty_delayed_payment_base_key : counterparty_delayed_payment_base_key. 0 . unwrap ( ) ,
342
340
counterparty_htlc_base_key : counterparty_htlc_base_key. 0 . unwrap ( ) ,
@@ -394,19 +392,19 @@ enum OnchainEvent {
394
392
}
395
393
396
394
impl_writeable_tlv_based ! ( OnchainEventEntry , {
397
- ( 0 , txid) ,
398
- ( 2 , height) ,
399
- ( 4 , event) ,
400
- } , { } , { } ) ;
395
+ ( 0 , txid, required ) ,
396
+ ( 2 , height, required ) ,
397
+ ( 4 , event, required ) ,
398
+ } ) ;
401
399
402
400
impl_writeable_tlv_based_enum ! ( OnchainEvent ,
403
401
( 0 , HTLCUpdate ) => {
404
- ( 0 , source) ,
405
- ( 2 , payment_hash) ,
406
- } , { } , { } ,
402
+ ( 0 , source, required ) ,
403
+ ( 2 , payment_hash, required ) ,
404
+ } ,
407
405
( 1 , MaturingOutput ) => {
408
- ( 0 , descriptor) ,
409
- } , { } , { } ,
406
+ ( 0 , descriptor, required ) ,
407
+ } ,
410
408
; ) ;
411
409
412
410
#[ cfg_attr( any( test, feature = "fuzztarget" , feature = "_test_utils" ) , derive( PartialEq ) ) ]
@@ -440,27 +438,25 @@ pub(crate) enum ChannelMonitorUpdateStep {
440
438
441
439
impl_writeable_tlv_based_enum ! ( ChannelMonitorUpdateStep ,
442
440
( 0 , LatestHolderCommitmentTXInfo ) => {
443
- ( 0 , commitment_tx) ,
444
- } , { } , {
445
- ( 2 , htlc_outputs) ,
441
+ ( 0 , commitment_tx, required) ,
442
+ ( 2 , htlc_outputs, vec_type) ,
446
443
} ,
447
444
( 1 , LatestCounterpartyCommitmentTXInfo ) => {
448
- ( 0 , commitment_txid) ,
449
- ( 2 , commitment_number) ,
450
- ( 4 , their_revocation_point) ,
451
- } , { } , {
452
- ( 6 , htlc_outputs) ,
445
+ ( 0 , commitment_txid, required) ,
446
+ ( 2 , commitment_number, required) ,
447
+ ( 4 , their_revocation_point, required) ,
448
+ ( 6 , htlc_outputs, vec_type) ,
453
449
} ,
454
450
( 2 , PaymentPreimage ) => {
455
- ( 0 , payment_preimage) ,
456
- } , { } , { } ,
451
+ ( 0 , payment_preimage, required ) ,
452
+ } ,
457
453
( 3 , CommitmentSecret ) => {
458
- ( 0 , idx) ,
459
- ( 2 , secret) ,
460
- } , { } , { } ,
454
+ ( 0 , idx, required ) ,
455
+ ( 2 , secret, required ) ,
456
+ } ,
461
457
( 4 , ChannelForceClosed ) => {
462
- ( 0 , should_broadcast) ,
463
- } , { } , { } ,
458
+ ( 0 , should_broadcast, required ) ,
459
+ } ,
464
460
; ) ;
465
461
466
462
/// A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
@@ -792,7 +788,7 @@ impl<Signer: Sign> Writeable for ChannelMonitorImpl<Signer> {
792
788
self . lockdown_from_offchain . write ( writer) ?;
793
789
self . holder_tx_signed . write ( writer) ?;
794
790
795
- write_tlv_fields ! ( writer, { } , { } ) ;
791
+ write_tlv_fields ! ( writer, { } ) ;
796
792
797
793
Ok ( ( ) )
798
794
}
@@ -2740,7 +2736,7 @@ impl<'a, Signer: Sign, K: KeysInterface<Signer = Signer>> ReadableArgs<&'a K>
2740
2736
let lockdown_from_offchain = Readable :: read ( reader) ?;
2741
2737
let holder_tx_signed = Readable :: read ( reader) ?;
2742
2738
2743
- read_tlv_fields ! ( reader, { } , { } ) ;
2739
+ read_tlv_fields ! ( reader, { } ) ;
2744
2740
2745
2741
let mut secp_ctx = Secp256k1 :: new ( ) ;
2746
2742
secp_ctx. seeded_randomize ( & keys_manager. get_secure_random_bytes ( ) ) ;
0 commit comments