@@ -249,6 +249,8 @@ pub enum Event {
249249 /// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
250250 /// [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
251251 PaymentReceived {
252+ /// The received node, ie whether the node was a phantom node or not.
253+ node_id : Option < PublicKey > ,
252254 /// The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
253255 /// not stop you from registering duplicate payment hashes for inbound payments.
254256 payment_hash : PaymentHash ,
@@ -273,6 +275,8 @@ pub enum Event {
273275 ///
274276 /// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
275277 PaymentClaimed {
278+ /// The received node, ie whether the node was a phantom node or not.
279+ node_id : Option < PublicKey > ,
276280 /// The payment hash of the claimed payment. Note that LDK will not stop you from
277281 /// registering duplicate payment hashes for inbound payments.
278282 payment_hash : PaymentHash ,
@@ -612,7 +616,7 @@ impl Writeable for Event {
612616 // We never write out FundingGenerationReady events as, upon disconnection, peers
613617 // drop any channels which have not yet exchanged funding_signed.
614618 } ,
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 } => {
616620 1u8 . write ( writer) ?;
617621 let mut payment_secret = None ;
618622 let payment_preimage;
@@ -631,6 +635,7 @@ impl Writeable for Event {
631635 ( 4 , amount_msat, required) ,
632636 ( 6 , 0u64 , required) , // user_payment_id required for compatibility with 0.0.103 and earlier
633637 ( 8 , payment_preimage, option) ,
638+ ( 10 , node_id, required) ,
634639 } ) ;
635640 } ,
636641 & Event :: PaymentSent { ref payment_id, ref payment_preimage, ref payment_hash, ref fee_paid_msat } => {
@@ -721,12 +726,13 @@ impl Writeable for Event {
721726 // We never write the OpenChannelRequest events as, upon disconnection, peers
722727 // drop any channels which have not yet exchanged funding_signed.
723728 } ,
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 } => {
725730 19u8 . write ( writer) ?;
726731 write_tlv_fields ! ( writer, {
727732 ( 0 , payment_hash, required) ,
728733 ( 2 , purpose, required) ,
729734 ( 4 , amount_msat, required) ,
735+ ( 6 , node_id, required) ,
730736 } ) ;
731737 } ,
732738 & Event :: ProbeSuccessful { ref payment_id, ref payment_hash, ref path } => {
@@ -772,13 +778,15 @@ impl MaybeReadable for Event {
772778 let mut payment_preimage = None ;
773779 let mut payment_secret = None ;
774780 let mut amount_msat = 0 ;
781+ let mut node_id = None ;
775782 let mut _user_payment_id = None :: < u64 > ; // For compatibility with 0.0.103 and earlier
776783 read_tlv_fields ! ( reader, {
777784 ( 0 , payment_hash, required) ,
778785 ( 2 , payment_secret, option) ,
779786 ( 4 , amount_msat, required) ,
780787 ( 6 , _user_payment_id, option) ,
781788 ( 8 , payment_preimage, option) ,
789+ ( 10 , node_id, required) ,
782790 } ) ;
783791 let purpose = match payment_secret {
784792 Some ( secret) => PaymentPurpose :: InvoicePayment {
@@ -789,6 +797,7 @@ impl MaybeReadable for Event {
789797 None => return Err ( msgs:: DecodeError :: InvalidValue ) ,
790798 } ;
791799 Ok ( Some ( Event :: PaymentReceived {
800+ node_id,
792801 payment_hash,
793802 amount_msat,
794803 purpose,
@@ -958,13 +967,17 @@ impl MaybeReadable for Event {
958967 let mut payment_hash = PaymentHash ( [ 0 ; 32 ] ) ;
959968 let mut purpose = None ;
960969 let mut amount_msat = 0 ;
970+ let mut node_id = None ;
961971 read_tlv_fields ! ( reader, {
962972 ( 0 , payment_hash, required) ,
963973 ( 2 , purpose, ignorable) ,
964974 ( 4 , amount_msat, required) ,
975+ ( 6 , node_id, required) ,
965976 } ) ;
966977 if purpose. is_none ( ) { return Ok ( None ) ; }
978+
967979 Ok ( Some ( Event :: PaymentClaimed {
980+ node_id,
968981 payment_hash,
969982 purpose : purpose. unwrap ( ) ,
970983 amount_msat,
0 commit comments