@@ -342,6 +342,12 @@ pub enum Event {
342
342
/// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
343
343
/// [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
344
344
PaymentReceived {
345
+ /// The node that received the payment.
346
+ /// This is useful to identify payments which were received via [phantom node payments].
347
+ /// This field will always be filled in when the event was generated by LDK versions 0.0.113 and above.
348
+ ///
349
+ /// [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
350
+ receiver_node_id : Option < PublicKey > ,
345
351
/// The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
346
352
/// not stop you from registering duplicate payment hashes for inbound payments.
347
353
payment_hash : PaymentHash ,
@@ -366,6 +372,12 @@ pub enum Event {
366
372
///
367
373
/// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
368
374
PaymentClaimed {
375
+ /// The node that received the payment.
376
+ /// This is useful to identify payments which were received via [phantom node payments].
377
+ /// This field will always be filled in when the event was generated by LDK versions 0.0.113 and above.
378
+ ///
379
+ /// [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
380
+ receiver_node_id : Option < PublicKey > ,
369
381
/// The payment hash of the claimed payment. Note that LDK will not stop you from
370
382
/// registering duplicate payment hashes for inbound payments.
371
383
payment_hash : PaymentHash ,
@@ -739,7 +751,7 @@ impl Writeable for Event {
739
751
// We never write out FundingGenerationReady events as, upon disconnection, peers
740
752
// drop any channels which have not yet exchanged funding_signed.
741
753
} ,
742
- & Event :: PaymentReceived { ref payment_hash, ref amount_msat, ref purpose } => {
754
+ & Event :: PaymentReceived { ref payment_hash, ref amount_msat, ref purpose, ref receiver_node_id } => {
743
755
1u8 . write ( writer) ?;
744
756
let mut payment_secret = None ;
745
757
let payment_preimage;
@@ -754,6 +766,7 @@ impl Writeable for Event {
754
766
}
755
767
write_tlv_fields ! ( writer, {
756
768
( 0 , payment_hash, required) ,
769
+ ( 1 , receiver_node_id, option) ,
757
770
( 2 , payment_secret, option) ,
758
771
( 4 , amount_msat, required) ,
759
772
( 6 , 0u64 , required) , // user_payment_id required for compatibility with 0.0.103 and earlier
@@ -854,10 +867,11 @@ impl Writeable for Event {
854
867
// We never write the OpenChannelRequest events as, upon disconnection, peers
855
868
// drop any channels which have not yet exchanged funding_signed.
856
869
} ,
857
- & Event :: PaymentClaimed { ref payment_hash, ref amount_msat, ref purpose } => {
870
+ & Event :: PaymentClaimed { ref payment_hash, ref amount_msat, ref purpose, ref receiver_node_id } => {
858
871
19u8 . write ( writer) ?;
859
872
write_tlv_fields ! ( writer, {
860
873
( 0 , payment_hash, required) ,
874
+ ( 1 , receiver_node_id, option) ,
861
875
( 2 , purpose, required) ,
862
876
( 4 , amount_msat, required) ,
863
877
} ) ;
@@ -923,9 +937,11 @@ impl MaybeReadable for Event {
923
937
let mut payment_preimage = None ;
924
938
let mut payment_secret = None ;
925
939
let mut amount_msat = 0 ;
940
+ let mut receiver_node_id = None ;
926
941
let mut _user_payment_id = None :: < u64 > ; // For compatibility with 0.0.103 and earlier
927
942
read_tlv_fields ! ( reader, {
928
943
( 0 , payment_hash, required) ,
944
+ ( 1 , receiver_node_id, option) ,
929
945
( 2 , payment_secret, option) ,
930
946
( 4 , amount_msat, required) ,
931
947
( 6 , _user_payment_id, option) ,
@@ -940,6 +956,7 @@ impl MaybeReadable for Event {
940
956
None => return Err ( msgs:: DecodeError :: InvalidValue ) ,
941
957
} ;
942
958
Ok ( Some ( Event :: PaymentReceived {
959
+ receiver_node_id,
943
960
payment_hash,
944
961
amount_msat,
945
962
purpose,
@@ -1117,13 +1134,16 @@ impl MaybeReadable for Event {
1117
1134
let mut payment_hash = PaymentHash ( [ 0 ; 32 ] ) ;
1118
1135
let mut purpose = None ;
1119
1136
let mut amount_msat = 0 ;
1137
+ let mut receiver_node_id = None ;
1120
1138
read_tlv_fields ! ( reader, {
1121
1139
( 0 , payment_hash, required) ,
1140
+ ( 1 , receiver_node_id, option) ,
1122
1141
( 2 , purpose, ignorable) ,
1123
1142
( 4 , amount_msat, required) ,
1124
1143
} ) ;
1125
1144
if purpose. is_none ( ) { return Ok ( None ) ; }
1126
1145
Ok ( Some ( Event :: PaymentClaimed {
1146
+ receiver_node_id,
1127
1147
payment_hash,
1128
1148
purpose : purpose. unwrap ( ) ,
1129
1149
amount_msat,
0 commit comments