@@ -291,6 +291,15 @@ impl StorableObject for PaymentDetails {
291291 }
292292 }
293293
294+ if let Some ( tx_id) = update. txid {
295+ match self . kind {
296+ PaymentKind :: Onchain { ref mut txid, .. } => {
297+ update_if_necessary ! ( * txid, tx_id) ;
298+ } ,
299+ _ => { } ,
300+ }
301+ }
302+
294303 if updated {
295304 self . latest_update_timestamp = SystemTime :: now ( )
296305 . duration_since ( UNIX_EPOCH )
@@ -540,6 +549,7 @@ pub(crate) struct PaymentDetailsUpdate {
540549 pub direction : Option < PaymentDirection > ,
541550 pub status : Option < PaymentStatus > ,
542551 pub confirmation_status : Option < ConfirmationStatus > ,
552+ pub txid : Option < Txid > ,
543553}
544554
545555impl PaymentDetailsUpdate {
@@ -555,6 +565,7 @@ impl PaymentDetailsUpdate {
555565 direction : None ,
556566 status : None ,
557567 confirmation_status : None ,
568+ txid : None ,
558569 }
559570 }
560571}
@@ -570,9 +581,9 @@ impl From<&PaymentDetails> for PaymentDetailsUpdate {
570581 _ => ( None , None , None ) ,
571582 } ;
572583
573- let confirmation_status = match value. kind {
574- PaymentKind :: Onchain { status, .. } => Some ( status) ,
575- _ => None ,
584+ let ( confirmation_status, txid ) = match & value. kind {
585+ PaymentKind :: Onchain { status, txid , .. } => ( Some ( * status) , Some ( * txid ) ) ,
586+ _ => ( None , None ) ,
576587 } ;
577588
578589 let counterparty_skimmed_fee_msat = match value. kind {
@@ -593,6 +604,7 @@ impl From<&PaymentDetails> for PaymentDetailsUpdate {
593604 direction : Some ( value. direction ) ,
594605 status : Some ( value. status ) ,
595606 confirmation_status,
607+ txid,
596608 }
597609 }
598610}
0 commit comments