@@ -249,6 +249,8 @@ pub enum Event {
249
249
/// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
250
250
/// [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
251
251
PaymentReceived {
252
+ /// The received node, ie whether the node was a phantom node or not.
253
+ node_id : Option < PublicKey > ,
252
254
/// The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
253
255
/// not stop you from registering duplicate payment hashes for inbound payments.
254
256
payment_hash : PaymentHash ,
@@ -273,6 +275,8 @@ pub enum Event {
273
275
///
274
276
/// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
275
277
PaymentClaimed {
278
+ /// The received node, ie whether the node was a phantom node or not.
279
+ node_id : Option < PublicKey > ,
276
280
/// The payment hash of the claimed payment. Note that LDK will not stop you from
277
281
/// registering duplicate payment hashes for inbound payments.
278
282
payment_hash : PaymentHash ,
@@ -612,7 +616,7 @@ impl Writeable for Event {
612
616
// We never write out FundingGenerationReady events as, upon disconnection, peers
613
617
// drop any channels which have not yet exchanged funding_signed.
614
618
} ,
615
- & Event :: PaymentReceived { ref payment_hash, ref amount_msat, ref purpose } => {
619
+ & Event :: PaymentReceived { ref node_id , ref payment_hash, ref amount_msat, ref purpose } => {
616
620
1u8 . write ( writer) ?;
617
621
let mut payment_secret = None ;
618
622
let payment_preimage;
@@ -631,6 +635,7 @@ impl Writeable for Event {
631
635
( 4 , amount_msat, required) ,
632
636
( 6 , 0u64 , required) , // user_payment_id required for compatibility with 0.0.103 and earlier
633
637
( 8 , payment_preimage, option) ,
638
+ ( 10 , node_id, required) ,
634
639
} ) ;
635
640
} ,
636
641
& Event :: PaymentSent { ref payment_id, ref payment_preimage, ref payment_hash, ref fee_paid_msat } => {
@@ -721,12 +726,13 @@ impl Writeable for Event {
721
726
// We never write the OpenChannelRequest events as, upon disconnection, peers
722
727
// drop any channels which have not yet exchanged funding_signed.
723
728
} ,
724
- & Event :: PaymentClaimed { ref payment_hash, ref amount_msat, ref purpose } => {
729
+ & Event :: PaymentClaimed { ref node_id , ref payment_hash, ref amount_msat, ref purpose } => {
725
730
19u8 . write ( writer) ?;
726
731
write_tlv_fields ! ( writer, {
727
732
( 0 , payment_hash, required) ,
728
733
( 2 , purpose, required) ,
729
734
( 4 , amount_msat, required) ,
735
+ ( 6 , node_id, required) ,
730
736
} ) ;
731
737
} ,
732
738
& Event :: ProbeSuccessful { ref payment_id, ref payment_hash, ref path } => {
@@ -772,13 +778,15 @@ impl MaybeReadable for Event {
772
778
let mut payment_preimage = None ;
773
779
let mut payment_secret = None ;
774
780
let mut amount_msat = 0 ;
781
+ let mut node_id = None ;
775
782
let mut _user_payment_id = None :: < u64 > ; // For compatibility with 0.0.103 and earlier
776
783
read_tlv_fields ! ( reader, {
777
784
( 0 , payment_hash, required) ,
778
785
( 2 , payment_secret, option) ,
779
786
( 4 , amount_msat, required) ,
780
787
( 6 , _user_payment_id, option) ,
781
788
( 8 , payment_preimage, option) ,
789
+ ( 10 , node_id, required) ,
782
790
} ) ;
783
791
let purpose = match payment_secret {
784
792
Some ( secret) => PaymentPurpose :: InvoicePayment {
@@ -789,6 +797,7 @@ impl MaybeReadable for Event {
789
797
None => return Err ( msgs:: DecodeError :: InvalidValue ) ,
790
798
} ;
791
799
Ok ( Some ( Event :: PaymentReceived {
800
+ node_id,
792
801
payment_hash,
793
802
amount_msat,
794
803
purpose,
@@ -958,13 +967,17 @@ impl MaybeReadable for Event {
958
967
let mut payment_hash = PaymentHash ( [ 0 ; 32 ] ) ;
959
968
let mut purpose = None ;
960
969
let mut amount_msat = 0 ;
970
+ let mut node_id = None ;
961
971
read_tlv_fields ! ( reader, {
962
972
( 0 , payment_hash, required) ,
963
973
( 2 , purpose, ignorable) ,
964
974
( 4 , amount_msat, required) ,
975
+ ( 6 , node_id, required) ,
965
976
} ) ;
966
977
if purpose. is_none ( ) { return Ok ( None ) ; }
978
+
967
979
Ok ( Some ( Event :: PaymentClaimed {
980
+ node_id,
968
981
payment_hash,
969
982
purpose : purpose. unwrap ( ) ,
970
983
amount_msat,
0 commit comments