@@ -21,7 +21,7 @@ use bitcoin::hash_types::Txid;
21
21
use bitcoin:: secp256k1:: key:: { SecretKey , PublicKey } ;
22
22
23
23
use ln:: PaymentPreimage ;
24
- use ln:: chan_utils:: { TxCreationKeys , HTLCOutputInCommitment , HTLC_OUTPUT_IN_COMMITMENT_SIZE } ;
24
+ use ln:: chan_utils:: { TxCreationKeys , HTLCOutputInCommitment } ;
25
25
use ln:: chan_utils;
26
26
use ln:: msgs:: DecodeError ;
27
27
use chain:: chaininterface:: { FeeEstimator , ConfirmationTarget , MIN_RELAY_FEE_SAT_PER_1000_WEIGHT } ;
@@ -86,15 +86,15 @@ impl RevokedOutput {
86
86
}
87
87
}
88
88
89
- impl_writeable ! ( RevokedOutput , 33 * 3 + 32 + 8 + 8 + 2 , {
90
- per_commitment_point,
91
- counterparty_delayed_payment_base_key,
92
- counterparty_htlc_base_key,
93
- per_commitment_key,
94
- weight,
95
- amount,
96
- on_counterparty_tx_csv
97
- } ) ;
89
+ impl_writeable_tlv_based ! ( RevokedOutput , {
90
+ ( 0 , per_commitment_point) ,
91
+ ( 2 , counterparty_delayed_payment_base_key) ,
92
+ ( 4 , counterparty_htlc_base_key) ,
93
+ ( 6 , per_commitment_key) ,
94
+ ( 8 , weight) ,
95
+ ( 10 , amount) ,
96
+ ( 12 , on_counterparty_tx_csv) ,
97
+ } , { } , { } ) ;
98
98
99
99
/// A struct to describe a revoked offered output and corresponding information to generate a
100
100
/// solving witness.
@@ -130,15 +130,15 @@ impl RevokedHTLCOutput {
130
130
}
131
131
}
132
132
133
- impl_writeable ! ( RevokedHTLCOutput , 33 * 3 + 32 + 8 + 8 + HTLC_OUTPUT_IN_COMMITMENT_SIZE , {
134
- per_commitment_point,
135
- counterparty_delayed_payment_base_key,
136
- counterparty_htlc_base_key,
137
- per_commitment_key,
138
- weight,
139
- amount,
140
- htlc
141
- } ) ;
133
+ impl_writeable_tlv_based ! ( RevokedHTLCOutput , {
134
+ ( 0 , per_commitment_point) ,
135
+ ( 2 , counterparty_delayed_payment_base_key) ,
136
+ ( 4 , counterparty_htlc_base_key) ,
137
+ ( 6 , per_commitment_key) ,
138
+ ( 8 , weight) ,
139
+ ( 10 , amount) ,
140
+ ( 12 , htlc) ,
141
+ } , { } , { } ) ;
142
142
143
143
/// A struct to describe a HTLC output on a counterparty commitment transaction.
144
144
///
@@ -167,13 +167,13 @@ impl CounterpartyOfferedHTLCOutput {
167
167
}
168
168
}
169
169
170
- impl_writeable ! ( CounterpartyOfferedHTLCOutput , 33 * 3 + 32 + HTLC_OUTPUT_IN_COMMITMENT_SIZE , {
171
- per_commitment_point,
172
- counterparty_delayed_payment_base_key,
173
- counterparty_htlc_base_key,
174
- preimage,
175
- htlc
176
- } ) ;
170
+ impl_writeable_tlv_based ! ( CounterpartyOfferedHTLCOutput , {
171
+ ( 0 , per_commitment_point) ,
172
+ ( 2 , counterparty_delayed_payment_base_key) ,
173
+ ( 4 , counterparty_htlc_base_key) ,
174
+ ( 6 , preimage) ,
175
+ ( 8 , htlc) ,
176
+ } , { } , { } ) ;
177
177
178
178
/// A struct to describe a HTLC output on a counterparty commitment transaction.
179
179
///
@@ -198,12 +198,12 @@ impl CounterpartyReceivedHTLCOutput {
198
198
}
199
199
}
200
200
201
- impl_writeable ! ( CounterpartyReceivedHTLCOutput , 33 * 3 + HTLC_OUTPUT_IN_COMMITMENT_SIZE , {
202
- per_commitment_point,
203
- counterparty_delayed_payment_base_key,
204
- counterparty_htlc_base_key,
205
- htlc
206
- } ) ;
201
+ impl_writeable_tlv_based ! ( CounterpartyReceivedHTLCOutput , {
202
+ ( 0 , per_commitment_point) ,
203
+ ( 2 , counterparty_delayed_payment_base_key) ,
204
+ ( 4 , counterparty_htlc_base_key) ,
205
+ ( 6 , htlc) ,
206
+ } , { } , { } ) ;
207
207
208
208
/// A struct to describe a HTLC output on holder commitment transaction.
209
209
///
@@ -224,10 +224,11 @@ impl HolderHTLCOutput {
224
224
}
225
225
}
226
226
227
- impl_writeable ! ( HolderHTLCOutput , 0 , {
228
- preimage,
229
- amount
230
- } ) ;
227
+ impl_writeable_tlv_based ! ( HolderHTLCOutput , {
228
+ ( 0 , amount, 0 ) ,
229
+ } , {
230
+ ( 2 , preimage) ,
231
+ } , { } ) ;
231
232
232
233
/// A struct to describe the channel output on the funding transaction.
233
234
///
@@ -245,9 +246,9 @@ impl HolderFundingOutput {
245
246
}
246
247
}
247
248
248
- impl_writeable ! ( HolderFundingOutput , 0 , {
249
- funding_redeemscript
250
- } ) ;
249
+ impl_writeable_tlv_based ! ( HolderFundingOutput , {
250
+ ( 0 , funding_redeemscript) ,
251
+ } , { } , { } ) ;
251
252
252
253
/// A wrapper encapsulating all in-protocol differing outputs types.
253
254
///
0 commit comments