@@ -95,7 +95,7 @@ impl Writeable for ChannelMonitorUpdate {
9595 for update_step in self . updates . iter ( ) {
9696 update_step. write ( w) ?;
9797 }
98- write_tlv_fields ! ( w, { } , { } ) ;
98+ write_tlv_fields ! ( w, { } ) ;
9999 Ok ( ( ) )
100100 }
101101}
@@ -108,7 +108,7 @@ impl Readable for ChannelMonitorUpdate {
108108 for _ in 0 ..len {
109109 updates. push ( Readable :: read ( r) ?) ;
110110 }
111- read_tlv_fields ! ( r, { } , { } ) ;
111+ read_tlv_fields ! ( r, { } ) ;
112112 Ok ( Self { update_id, updates } )
113113 }
114114}
@@ -202,11 +202,10 @@ pub struct HTLCUpdate {
202202 pub ( crate ) source : HTLCSource
203203}
204204impl_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+ } ) ;
210209
211210/// If an HTLC expires within this many blocks, don't try to claim it in a shared transaction,
212211/// instead claiming it in its own individual transaction.
@@ -273,15 +272,14 @@ struct HolderSignedTx {
273272 htlc_outputs : Vec < ( HTLCOutputInCommitment , Option < Signature > , Option < HTLCSource > ) > ,
274273}
275274impl_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)
285283} ) ;
286284
287285/// We use this to track counterparty commitment transactions and htlcs outputs and
@@ -305,10 +303,10 @@ impl Writeable for CounterpartyCommitmentTransaction {
305303 }
306304 }
307305 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+ } ) ;
312310 Ok ( ( ) )
313311 }
314312}
@@ -333,10 +331,10 @@ impl Readable for CounterpartyCommitmentTransaction {
333331 let mut counterparty_htlc_base_key = OptionDeserWrapper ( None ) ;
334332 let mut on_counterparty_tx_csv: u16 = 0 ;
335333 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+ } ) ;
340338 CounterpartyCommitmentTransaction {
341339 counterparty_delayed_payment_base_key : counterparty_delayed_payment_base_key. 0 . unwrap ( ) ,
342340 counterparty_htlc_base_key : counterparty_htlc_base_key. 0 . unwrap ( ) ,
@@ -394,19 +392,19 @@ enum OnchainEvent {
394392}
395393
396394impl_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+ } ) ;
401399
402400impl_writeable_tlv_based_enum ! ( OnchainEvent ,
403401 ( 0 , HTLCUpdate ) => {
404- ( 0 , source) ,
405- ( 2 , payment_hash) ,
406- } , { } , { } ,
402+ ( 0 , source, required ) ,
403+ ( 2 , payment_hash, required ) ,
404+ } ,
407405 ( 1 , MaturingOutput ) => {
408- ( 0 , descriptor) ,
409- } , { } , { } ,
406+ ( 0 , descriptor, required ) ,
407+ } ,
410408; ) ;
411409
412410#[ cfg_attr( any( test, feature = "fuzztarget" , feature = "_test_utils" ) , derive( PartialEq ) ) ]
@@ -440,27 +438,25 @@ pub(crate) enum ChannelMonitorUpdateStep {
440438
441439impl_writeable_tlv_based_enum ! ( ChannelMonitorUpdateStep ,
442440 ( 0 , LatestHolderCommitmentTXInfo ) => {
443- ( 0 , commitment_tx) ,
444- } , { } , {
445- ( 2 , htlc_outputs) ,
441+ ( 0 , commitment_tx, required) ,
442+ ( 2 , htlc_outputs, vec_type) ,
446443 } ,
447444 ( 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) ,
453449 } ,
454450 ( 2 , PaymentPreimage ) => {
455- ( 0 , payment_preimage) ,
456- } , { } , { } ,
451+ ( 0 , payment_preimage, required ) ,
452+ } ,
457453 ( 3 , CommitmentSecret ) => {
458- ( 0 , idx) ,
459- ( 2 , secret) ,
460- } , { } , { } ,
454+ ( 0 , idx, required ) ,
455+ ( 2 , secret, required ) ,
456+ } ,
461457 ( 4 , ChannelForceClosed ) => {
462- ( 0 , should_broadcast) ,
463- } , { } , { } ,
458+ ( 0 , should_broadcast, required ) ,
459+ } ,
464460; ) ;
465461
466462/// A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
@@ -792,7 +788,7 @@ impl<Signer: Sign> Writeable for ChannelMonitorImpl<Signer> {
792788 self . lockdown_from_offchain . write ( writer) ?;
793789 self . holder_tx_signed . write ( writer) ?;
794790
795- write_tlv_fields ! ( writer, { } , { } ) ;
791+ write_tlv_fields ! ( writer, { } ) ;
796792
797793 Ok ( ( ) )
798794 }
@@ -2740,7 +2736,7 @@ impl<'a, Signer: Sign, K: KeysInterface<Signer = Signer>> ReadableArgs<&'a K>
27402736 let lockdown_from_offchain = Readable :: read ( reader) ?;
27412737 let holder_tx_signed = Readable :: read ( reader) ?;
27422738
2743- read_tlv_fields ! ( reader, { } , { } ) ;
2739+ read_tlv_fields ! ( reader, { } ) ;
27442740
27452741 let mut secp_ctx = Secp256k1 :: new ( ) ;
27462742 secp_ctx. seeded_randomize ( & keys_manager. get_secure_random_bytes ( ) ) ;
0 commit comments