@@ -19,10 +19,6 @@ use lightning::{
1919use lightning_types:: payment:: { PaymentHash , PaymentPreimage , PaymentSecret } ;
2020use lightning_types:: string:: UntrustedString ;
2121
22- use bitcoin:: { BlockHash , Transaction , Txid } ;
23-
24- use std:: time:: { Duration , SystemTime , UNIX_EPOCH } ;
25-
2622use crate :: data_store:: { StorableObject , StorableObjectId , StorableObjectUpdate } ;
2723use crate :: hex_utils;
2824
@@ -295,28 +291,10 @@ impl StorableObject for PaymentDetails {
295291 }
296292 }
297293
298- if let Some ( tx) = & update. raw_tx {
299- match self . kind {
300- PaymentKind :: Onchain { ref mut raw_tx, .. } => {
301- update_if_necessary ! ( * raw_tx, tx. clone( ) ) ;
302- } ,
303- _ => { } ,
304- }
305- }
306-
307- if let Some ( attempts) = update. broadcast_attempts {
294+ if let Some ( tx_id) = update. txid {
308295 match self . kind {
309- PaymentKind :: Onchain { ref mut broadcast_attempts, .. } => {
310- update_if_necessary ! ( * broadcast_attempts, attempts) ;
311- } ,
312- _ => { } ,
313- }
314- }
315-
316- if let Some ( broadcast_time) = update. last_broadcast_time {
317- match self . kind {
318- PaymentKind :: Onchain { ref mut last_broadcast_time, .. } => {
319- update_if_necessary ! ( * last_broadcast_time, broadcast_time) ;
296+ PaymentKind :: Onchain { ref mut txid, .. } => {
297+ update_if_necessary ! ( * txid, tx_id) ;
320298 } ,
321299 _ => { } ,
322300 }
@@ -382,12 +360,6 @@ pub enum PaymentKind {
382360 txid : Txid ,
383361 /// The confirmation status of this payment.
384362 status : ConfirmationStatus ,
385- /// The raw transaction for rebroadcasting
386- raw_tx : Option < Transaction > ,
387- /// Last broadcast attempt timestamp (UNIX seconds)
388- last_broadcast_time : Option < u64 > ,
389- /// Number of broadcast attempts
390- broadcast_attempts : Option < u32 > ,
391363 } ,
392364 /// A [BOLT 11] payment.
393365 ///
@@ -485,10 +457,7 @@ pub enum PaymentKind {
485457impl_writeable_tlv_based_enum ! ( PaymentKind ,
486458 ( 0 , Onchain ) => {
487459 ( 0 , txid, required) ,
488- ( 1 , raw_tx, option) ,
489460 ( 2 , status, required) ,
490- ( 3 , last_broadcast_time, option) ,
491- ( 5 , broadcast_attempts, option) ,
492461 } ,
493462 ( 2 , Bolt11 ) => {
494463 ( 0 , hash, required) ,
@@ -580,9 +549,7 @@ pub(crate) struct PaymentDetailsUpdate {
580549 pub direction : Option < PaymentDirection > ,
581550 pub status : Option < PaymentStatus > ,
582551 pub confirmation_status : Option < ConfirmationStatus > ,
583- pub raw_tx : Option < Option < Transaction > > ,
584- pub last_broadcast_time : Option < Option < u64 > > ,
585- pub broadcast_attempts : Option < Option < u32 > > ,
552+ pub txid : Option < Txid > ,
586553}
587554
588555impl PaymentDetailsUpdate {
@@ -598,9 +565,7 @@ impl PaymentDetailsUpdate {
598565 direction : None ,
599566 status : None ,
600567 confirmation_status : None ,
601- raw_tx : None ,
602- last_broadcast_time : None ,
603- broadcast_attempts : None ,
568+ txid : None ,
604569 }
605570 }
606571}
@@ -616,17 +581,10 @@ impl From<&PaymentDetails> for PaymentDetailsUpdate {
616581 _ => ( None , None , None ) ,
617582 } ;
618583
619- let ( confirmation_status, raw_tx, last_broadcast_time, broadcast_attempts) =
620- match & value. kind {
621- PaymentKind :: Onchain {
622- status,
623- raw_tx,
624- last_broadcast_time,
625- broadcast_attempts,
626- ..
627- } => ( Some ( * status) , raw_tx. clone ( ) , * last_broadcast_time, * broadcast_attempts) ,
628- _ => ( None , None , None , None ) ,
629- } ;
584+ let ( confirmation_status, txid) = match & value. kind {
585+ PaymentKind :: Onchain { status, txid, .. } => ( Some ( * status) , Some ( * txid) ) ,
586+ _ => ( None , None ) ,
587+ } ;
630588
631589 let counterparty_skimmed_fee_msat = match value. kind {
632590 PaymentKind :: Bolt11Jit { counterparty_skimmed_fee_msat, .. } => {
@@ -646,9 +604,7 @@ impl From<&PaymentDetails> for PaymentDetailsUpdate {
646604 direction : Some ( value. direction ) ,
647605 status : Some ( value. status ) ,
648606 confirmation_status,
649- raw_tx : Some ( raw_tx) ,
650- last_broadcast_time : Some ( last_broadcast_time) ,
651- broadcast_attempts : Some ( broadcast_attempts) ,
607+ txid,
652608 }
653609 }
654610}
0 commit comments