@@ -342,6 +342,8 @@ 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
344344 PaymentReceived {
345+ /// The received node, ie whether the node was a phantom node or not.
346+ node_id : Option < PublicKey > ,
345347 /// The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
346348 /// not stop you from registering duplicate payment hashes for inbound payments.
347349 payment_hash : PaymentHash ,
@@ -366,6 +368,8 @@ pub enum Event {
366368 ///
367369 /// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
368370 PaymentClaimed {
371+ /// The received node, ie whether the node was a phantom node or not.
372+ node_id : Option < PublicKey > ,
369373 /// The payment hash of the claimed payment. Note that LDK will not stop you from
370374 /// registering duplicate payment hashes for inbound payments.
371375 payment_hash : PaymentHash ,
@@ -739,7 +743,7 @@ impl Writeable for Event {
739743 // We never write out FundingGenerationReady events as, upon disconnection, peers
740744 // drop any channels which have not yet exchanged funding_signed.
741745 } ,
742- & Event :: PaymentReceived { ref payment_hash, ref amount_msat, ref purpose } => {
746+ & Event :: PaymentReceived { ref node_id , ref payment_hash, ref amount_msat, ref purpose } => {
743747 1u8 . write ( writer) ?;
744748 let mut payment_secret = None ;
745749 let payment_preimage;
@@ -758,6 +762,7 @@ impl Writeable for Event {
758762 ( 4 , amount_msat, required) ,
759763 ( 6 , 0u64 , required) , // user_payment_id required for compatibility with 0.0.103 and earlier
760764 ( 8 , payment_preimage, option) ,
765+ ( 10 , node_id, required) ,
761766 } ) ;
762767 } ,
763768 & Event :: PaymentSent { ref payment_id, ref payment_preimage, ref payment_hash, ref fee_paid_msat } => {
@@ -854,12 +859,13 @@ impl Writeable for Event {
854859 // We never write the OpenChannelRequest events as, upon disconnection, peers
855860 // drop any channels which have not yet exchanged funding_signed.
856861 } ,
857- & Event :: PaymentClaimed { ref payment_hash, ref amount_msat, ref purpose } => {
862+ & Event :: PaymentClaimed { ref node_id , ref payment_hash, ref amount_msat, ref purpose } => {
858863 19u8 . write ( writer) ?;
859864 write_tlv_fields ! ( writer, {
860865 ( 0 , payment_hash, required) ,
861866 ( 2 , purpose, required) ,
862867 ( 4 , amount_msat, required) ,
868+ ( 6 , node_id, required) ,
863869 } ) ;
864870 } ,
865871 & Event :: ProbeSuccessful { ref payment_id, ref payment_hash, ref path } => {
@@ -923,13 +929,15 @@ impl MaybeReadable for Event {
923929 let mut payment_preimage = None ;
924930 let mut payment_secret = None ;
925931 let mut amount_msat = 0 ;
932+ let mut node_id = None ;
926933 let mut _user_payment_id = None :: < u64 > ; // For compatibility with 0.0.103 and earlier
927934 read_tlv_fields ! ( reader, {
928935 ( 0 , payment_hash, required) ,
929936 ( 2 , payment_secret, option) ,
930937 ( 4 , amount_msat, required) ,
931938 ( 6 , _user_payment_id, option) ,
932939 ( 8 , payment_preimage, option) ,
940+ ( 10 , node_id, required) ,
933941 } ) ;
934942 let purpose = match payment_secret {
935943 Some ( secret) => PaymentPurpose :: InvoicePayment {
@@ -940,6 +948,7 @@ impl MaybeReadable for Event {
940948 None => return Err ( msgs:: DecodeError :: InvalidValue ) ,
941949 } ;
942950 Ok ( Some ( Event :: PaymentReceived {
951+ node_id,
943952 payment_hash,
944953 amount_msat,
945954 purpose,
@@ -1117,13 +1126,17 @@ impl MaybeReadable for Event {
11171126 let mut payment_hash = PaymentHash ( [ 0 ; 32 ] ) ;
11181127 let mut purpose = None ;
11191128 let mut amount_msat = 0 ;
1129+ let mut node_id = None ;
11201130 read_tlv_fields ! ( reader, {
11211131 ( 0 , payment_hash, required) ,
11221132 ( 2 , purpose, ignorable) ,
11231133 ( 4 , amount_msat, required) ,
1134+ ( 6 , node_id, required) ,
11241135 } ) ;
11251136 if purpose. is_none ( ) { return Ok ( None ) ; }
1137+
11261138 Ok ( Some ( Event :: PaymentClaimed {
1139+ node_id,
11271140 payment_hash,
11281141 purpose : purpose. unwrap ( ) ,
11291142 amount_msat,
0 commit comments