File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -365,6 +365,15 @@ impl<S: MutinyStorage> EventHandler<S> {
365
365
}
366
366
}
367
367
}
368
+
369
+ if let Some ( cb) = self . ln_event_callback . as_ref ( ) {
370
+ let event = CommonLnEvent :: PaymentClaimed {
371
+ receiver_node_id : receiver_node_id. map ( |node_id| format ! ( "{node_id}" ) ) ,
372
+ amount_msat,
373
+ payment_hash : format ! ( "{payment_hash:x}" ) ,
374
+ } ;
375
+ cb. trigger ( event) ;
376
+ }
368
377
}
369
378
Event :: PaymentSent {
370
379
payment_preimage,
@@ -406,6 +415,12 @@ impl<S: MutinyStorage> EventHandler<S> {
406
415
) ;
407
416
}
408
417
}
418
+ if let Some ( cb) = self . ln_event_callback . as_ref ( ) {
419
+ let event = CommonLnEvent :: PaymentSent {
420
+ payment_hash : format ! ( "{payment_hash:x}" ) ,
421
+ } ;
422
+ cb. trigger ( event) ;
423
+ }
409
424
}
410
425
Event :: OpenChannelRequest {
411
426
temporary_channel_id,
@@ -525,6 +540,13 @@ impl<S: MutinyStorage> EventHandler<S> {
525
540
) ;
526
541
}
527
542
}
543
+ if let Some ( cb) = self . ln_event_callback . as_ref ( ) {
544
+ let event = CommonLnEvent :: PaymentFailed {
545
+ payment_hash : format ! ( "{payment_hash:x}" ) ,
546
+ reason : reason. map ( |r| format ! ( "{r:?}" ) ) ,
547
+ } ;
548
+ cb. trigger ( event) ;
549
+ }
528
550
}
529
551
}
530
552
Event :: PaymentForwarded { .. } => {
Original file line number Diff line number Diff line change @@ -39,6 +39,23 @@ pub enum CommonLnEvent {
39
39
// this must only be used to report debugging information.
40
40
maybe_force_closed : bool ,
41
41
} ,
42
+ // Sent payment
43
+ PaymentSent {
44
+ payment_hash : String ,
45
+ } ,
46
+ // Sent payment failed
47
+ PaymentFailed {
48
+ payment_hash : String ,
49
+ reason : Option < String > ,
50
+ } ,
51
+ // Received payment
52
+ PaymentClaimed {
53
+ /// The node that received the payment.
54
+ receiver_node_id : Option < String > ,
55
+ /// The payment hash of the payment.
56
+ payment_hash : String ,
57
+ amount_msat : u64 ,
58
+ } ,
42
59
}
43
60
44
61
#[ derive( Clone ) ]
You can’t perform that action at this time.
0 commit comments