@@ -342,6 +342,13 @@ pub enum Event {
342342/// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds 
343343/// [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards 
344344PaymentReceived  { 
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 
348+ /// 0.0.113 and above. 
349+ /// 
350+ /// [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager 
351+ receiver_node_id :  Option < PublicKey > , 
345352		/// The hash for which the preimage should be handed to the ChannelManager. Note that LDK will 
346353/// not stop you from registering duplicate payment hashes for inbound payments. 
347354payment_hash :  PaymentHash , 
@@ -366,6 +373,13 @@ pub enum Event {
366373/// 
367374/// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds 
368375PaymentClaimed  { 
376+ 		/// The node that received the payment. 
377+ /// This is useful to identify payments which were received via [phantom node payments]. 
378+ /// This field will always be filled in when the event was generated by LDK versions 
379+ /// 0.0.113 and above. 
380+ /// 
381+ /// [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager 
382+ receiver_node_id :  Option < PublicKey > , 
369383		/// The payment hash of the claimed payment. Note that LDK will not stop you from 
370384/// registering duplicate payment hashes for inbound payments. 
371385payment_hash :  PaymentHash , 
@@ -739,7 +753,7 @@ impl Writeable for Event {
739753				// We never write out FundingGenerationReady events as, upon disconnection, peers 
740754				// drop any channels which have not yet exchanged funding_signed. 
741755			} , 
742- 			& Event :: PaymentReceived  {  ref  payment_hash,  ref  amount_msat,  ref  purpose }  => { 
756+ 			& Event :: PaymentReceived  {  ref  payment_hash,  ref  amount_msat,  ref  purpose,   ref  receiver_node_id  }  => { 
743757				1u8 . write ( writer) ?; 
744758				let  mut  payment_secret = None ; 
745759				let  payment_preimage; 
@@ -754,6 +768,7 @@ impl Writeable for Event {
754768				} 
755769				write_tlv_fields ! ( writer,  { 
756770					( 0 ,  payment_hash,  required) , 
771+ 					( 1 ,  receiver_node_id,  option) , 
757772					( 2 ,  payment_secret,  option) , 
758773					( 4 ,  amount_msat,  required) , 
759774					( 6 ,  0u64 ,  required) ,  // user_payment_id required for compatibility with 0.0.103 and earlier 
@@ -854,10 +869,11 @@ impl Writeable for Event {
854869				// We never write the OpenChannelRequest events as, upon disconnection, peers 
855870				// drop any channels which have not yet exchanged funding_signed. 
856871			} , 
857- 			& Event :: PaymentClaimed  {  ref  payment_hash,  ref  amount_msat,  ref  purpose }  => { 
872+ 			& Event :: PaymentClaimed  {  ref  payment_hash,  ref  amount_msat,  ref  purpose,   ref  receiver_node_id  }  => { 
858873				19u8 . write ( writer) ?; 
859874				write_tlv_fields ! ( writer,  { 
860875					( 0 ,  payment_hash,  required) , 
876+ 					( 1 ,  receiver_node_id,  option) , 
861877					( 2 ,  purpose,  required) , 
862878					( 4 ,  amount_msat,  required) , 
863879				} ) ; 
@@ -923,9 +939,11 @@ impl MaybeReadable for Event {
923939					let  mut  payment_preimage = None ; 
924940					let  mut  payment_secret = None ; 
925941					let  mut  amount_msat = 0 ; 
942+ 					let  mut  receiver_node_id = None ; 
926943					let  mut  _user_payment_id = None :: < u64 > ;  // For compatibility with 0.0.103 and earlier 
927944					read_tlv_fields ! ( reader,  { 
928945						( 0 ,  payment_hash,  required) , 
946+ 						( 1 ,  receiver_node_id,  option) , 
929947						( 2 ,  payment_secret,  option) , 
930948						( 4 ,  amount_msat,  required) , 
931949						( 6 ,  _user_payment_id,  option) , 
@@ -940,6 +958,7 @@ impl MaybeReadable for Event {
940958						None  => return  Err ( msgs:: DecodeError :: InvalidValue ) , 
941959					} ; 
942960					Ok ( Some ( Event :: PaymentReceived  { 
961+ 						receiver_node_id, 
943962						payment_hash, 
944963						amount_msat, 
945964						purpose, 
@@ -1117,13 +1136,16 @@ impl MaybeReadable for Event {
11171136					let  mut  payment_hash = PaymentHash ( [ 0 ;  32 ] ) ; 
11181137					let  mut  purpose = None ; 
11191138					let  mut  amount_msat = 0 ; 
1139+ 					let  mut  receiver_node_id = None ; 
11201140					read_tlv_fields ! ( reader,  { 
11211141						( 0 ,  payment_hash,  required) , 
1142+ 						( 1 ,  receiver_node_id,  option) , 
11221143						( 2 ,  purpose,  ignorable) , 
11231144						( 4 ,  amount_msat,  required) , 
11241145					} ) ; 
11251146					if  purpose. is_none ( )  {  return  Ok ( None ) ;  } 
11261147					Ok ( Some ( Event :: PaymentClaimed  { 
1148+ 						receiver_node_id, 
11271149						payment_hash, 
11281150						purpose :  purpose. unwrap ( ) , 
11291151						amount_msat, 
0 commit comments