@@ -227,6 +227,37 @@ pub struct AnchorDescriptor {
227
227
pub outpoint : OutPoint ,
228
228
}
229
229
230
+ #[ cfg( anchors) ]
231
+ /// A descriptor used to sign for a commitment transaction's HTLC output.
232
+ #[ derive( Clone , Debug ) ]
233
+ pub enum HTLCDescriptor {
234
+ /// A variant used to sign for HTLC inputs being spent by their pre-signed second-stage
235
+ /// transactions.
236
+ SecondStage {
237
+ /// A unique identifier used along with `channel_value_satoshis` to re-derive the
238
+ /// [`InMemorySigner`] required to sign `input`.
239
+ ///
240
+ /// [`InMemorySigner`]: crate::chain::keysinterface::InMemorySigner
241
+ channel_keys_id : [ u8 ; 32 ] ,
242
+ /// The value in satoshis of the channel we're attempting to spend the anchor output of. This is
243
+ /// used along with `channel_keys_id` to re-derive the [`InMemorySigner`] required to sign
244
+ /// `input`.
245
+ ///
246
+ /// [`InMemorySigner`]: crate::chain::keysinterface::InMemorySigner
247
+ channel_value_satoshis : u64 ,
248
+ /// The amount in satoshis of the HTLC output in the commitment transaction.
249
+ amount_satoshis : u64 ,
250
+ /// The number of the commitment transaction in which the HTLC output lives.
251
+ per_commitment_number : u64 ,
252
+ /// The redeem script that satisfies the HTLC output script.
253
+ redeem_script : Script ,
254
+ /// The preimage, if one exists, to claim the HTLC output with.
255
+ preimage : Option < PaymentPreimage > ,
256
+ /// The counterparty's signature required to spend the HTLC output.
257
+ counterparty_sig : Signature
258
+ }
259
+ }
260
+
230
261
#[ cfg( anchors) ]
231
262
/// Represents the different types of transactions, originating from LDK, to be bumped.
232
263
#[ derive( Clone , Debug ) ]
@@ -294,18 +325,16 @@ pub enum BumpTransactionEvent {
294
325
/// onchain. With the zero-HTLC-transaction-fee variant of anchor outputs, the pre-signed HTLC
295
326
/// transactions have a zero fee, thus requiring additional inputs and/or outputs to be attached
296
327
/// for a timely confirmation within the chain. These additional inputs and/or outputs must be
297
- /// appended to the enclosed `tx_template` to meet the target feerate. Consumers must ensure the
298
- /// order of pre-existing inputs and outputs within `tx_template` are not changed, as it is
299
- /// crucial to the validity of the transaction itself. Failure to meet the target feerate
300
- /// decreases the confirmation odds of the transaction, possinly resulting in a loss of funds.
301
- /// Once the transaction is amended to meet the target feerate, it must be signed for and
302
- /// broadcast by the consumer of the event.
328
+ /// appended to the enclosed `tx_template` to meet the target feerate. Failure to meet the
329
+ /// target feerate decreases the confirmation odds of the transaction, possibly resulting in a
330
+ /// loss of funds. Once the transaction is amended to meet the target feerate, it must be signed
331
+ /// for and broadcast by the consumer of the event.
303
332
///
304
333
/// The consumer should be able to sign for any of the additional inputs added to `tx_template`.
305
334
/// To sign HTLC inputs, an [`InMemorySigner`] should be re-derived through
306
335
/// [`KeysManager::derive_channel_keys`] with the help of `channel_keys_id` and
307
- /// `AnchorDescriptor:: channel_value_satoshis`. Each HTLC input's signature can be computed
308
- /// with [`InMemorySigner::sign_holder_htlc_transaction`], which can then be provided to
336
+ /// `channel_value_satoshis`. Each HTLC input's signature can be computed with
337
+ /// [`InMemorySigner::sign_holder_htlc_transaction`], which can then be provided to
309
338
/// [`build_htlc_input_witness`] along with the enclosed [`HTLCDescriptor`] to obtain the full
310
339
/// witness required to spend.
311
340
///
@@ -328,19 +357,6 @@ pub enum BumpTransactionEvent {
328
357
} ,
329
358
}
330
359
331
- #[ derive( Clone , Debug ) ]
332
- pub enum HTLCDescriptor {
333
- SecondStage {
334
- channel_keys_id : [ u8 ; 32 ] ,
335
- channel_value_satoshis : u64 ,
336
- amount : u64 ,
337
- per_commitment_number : u64 ,
338
- redeem_script : Script ,
339
- preimage : Option < PaymentPreimage > ,
340
- counterparty_sig : Signature
341
- }
342
- }
343
-
344
360
/// An Event which you should probably take some action in response to.
345
361
///
346
362
/// Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
0 commit comments