@@ -42,7 +42,7 @@ use lightning_liquidity::lsps2::utils::compute_opening_fee;
4242
4343use bitcoin:: blockdata:: locktime:: absolute:: LockTime ;
4444use bitcoin:: secp256k1:: PublicKey ;
45- use bitcoin:: { Amount , OutPoint } ;
45+ use bitcoin:: { Amount , BlockHash , OutPoint , Txid } ;
4646
4747use rand:: { thread_rng, Rng } ;
4848
@@ -221,6 +221,41 @@ pub enum Event {
221221 /// This will be `None` for events serialized by LDK Node v0.2.1 and prior.
222222 reason : Option < ClosureReason > ,
223223 } ,
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+ } ,
224259}
225260
226261impl_writeable_tlv_based_enum ! ( Event ,
@@ -277,7 +312,21 @@ impl_writeable_tlv_based_enum!(Event,
277312 ( 10 , skimmed_fee_msat, option) ,
278313 ( 12 , claim_from_onchain_tx, required) ,
279314 ( 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+ } ,
281330) ;
282331
283332pub struct EventQueue < L : Deref >
0 commit comments