@@ -42,7 +42,7 @@ use lightning_liquidity::lsps2::utils::compute_opening_fee;
42
42
43
43
use bitcoin:: blockdata:: locktime:: absolute:: LockTime ;
44
44
use bitcoin:: secp256k1:: PublicKey ;
45
- use bitcoin:: { Amount , OutPoint } ;
45
+ use bitcoin:: { Amount , BlockHash , OutPoint , Txid } ;
46
46
47
47
use rand:: { thread_rng, Rng } ;
48
48
@@ -221,6 +221,41 @@ pub enum Event {
221
221
/// This will be `None` for events serialized by LDK Node v0.2.1 and prior.
222
222
reason : Option < ClosureReason > ,
223
223
} ,
224
+ /// A sent onchain payment was successful.
225
+ ///
226
+ /// It's guaranteed to have reached at least [`ANTI_REORG_DELAY`] delay confirmations.
227
+ ///
228
+ ///
229
+ /// [`ANTI_REORG_DELAY`]: lightning::chain::channelmonitor::ANTI_REORG_DELAY
230
+ OnchainPaymentSuccessful {
231
+ /// A local identifier used to track the payment.
232
+ payment_id : PaymentId ,
233
+ /// The transaction identifier.
234
+ txid : Txid ,
235
+ /// The value, in thousandths of a satoshi, that has been received.
236
+ amount_msat : u64 ,
237
+ /// The hash of the block in which the transaction was confirmed.
238
+ block_hash : BlockHash ,
239
+ /// The height under which the block was confirmed.
240
+ block_height : u32 ,
241
+ } ,
242
+ /// An onchain payment has been received.
243
+ ///
244
+ /// It's guaranteed to have reached at least [`ANTI_REORG_DELAY`] delay confirmations.
245
+ ///
246
+ /// [`ANTI_REORG_DELAY`]: lightning::chain::channelmonitor::ANTI_REORG_DELAY
247
+ OnchainPaymentReceived {
248
+ /// A local identifier used to track the payment.
249
+ payment_id : PaymentId ,
250
+ /// The transaction identifier.
251
+ txid : Txid ,
252
+ /// The value, in thousandths of a satoshi, that has been received.
253
+ amount_msat : u64 ,
254
+ /// The hash of the block in which the transaction was confirmed.
255
+ block_hash : BlockHash ,
256
+ /// The height under which the block was confirmed.
257
+ block_height : u32 ,
258
+ } ,
224
259
}
225
260
226
261
impl_writeable_tlv_based_enum ! ( Event ,
@@ -277,7 +312,21 @@ impl_writeable_tlv_based_enum!(Event,
277
312
( 10 , skimmed_fee_msat, option) ,
278
313
( 12 , claim_from_onchain_tx, required) ,
279
314
( 14 , outbound_amount_forwarded_msat, option) ,
280
- }
315
+ } ,
316
+ ( 8 , OnchainPaymentSuccessful ) => {
317
+ ( 0 , payment_id, required) ,
318
+ ( 2 , txid, required) ,
319
+ ( 4 , amount_msat, required) ,
320
+ ( 6 , block_hash, required) ,
321
+ ( 8 , block_height, required) ,
322
+ } ,
323
+ ( 9 , OnchainPaymentReceived ) => {
324
+ ( 0 , payment_id, required) ,
325
+ ( 2 , txid, required) ,
326
+ ( 4 , amount_msat, required) ,
327
+ ( 6 , block_hash, required) ,
328
+ ( 8 , block_height, required) ,
329
+ } ,
281
330
) ;
282
331
283
332
pub struct EventQueue < L : Deref >
0 commit comments