@@ -603,13 +603,12 @@ impl<S: MutinyStorage> FederationClient<S> {
603603 fn maybe_update_after_checking_fedimint (
604604 & self ,
605605 updated_invoice : MutinyInvoice ,
606- ) -> Result < ( ) , MutinyError > {
606+ ) -> Result < MutinyInvoice , MutinyError > {
607607 maybe_update_after_checking_fedimint (
608608 updated_invoice,
609609 self . logger . clone ( ) ,
610610 self . storage . clone ( ) ,
611- ) ?;
612- Ok ( ( ) )
611+ )
613612 }
614613
615614 pub ( crate ) async fn pay_invoice (
@@ -679,7 +678,7 @@ impl<S: MutinyStorage> FederationClient<S> {
679678 } ;
680679 inv. fees_paid = Some ( sats_round_up ( & outgoing_payment. fee ) ) ;
681680
682- self . maybe_update_after_checking_fedimint ( inv. clone ( ) ) ?;
681+ inv = self . maybe_update_after_checking_fedimint ( inv) ?;
683682
684683 match inv. status {
685684 HTLCStatus :: Succeeded => Ok ( inv) ,
@@ -1081,23 +1080,28 @@ fn subscribe_operation_ext<S: MutinyStorage>(
10811080}
10821081
10831082fn maybe_update_after_checking_fedimint < S : MutinyStorage > (
1084- updated_invoice : MutinyInvoice ,
1083+ mut updated_invoice : MutinyInvoice ,
10851084 logger : Arc < MutinyLogger > ,
10861085 storage : S ,
1087- ) -> Result < ( ) , MutinyError > {
1086+ ) -> Result < MutinyInvoice , MutinyError > {
10881087 match updated_invoice. status {
10891088 HTLCStatus :: Succeeded | HTLCStatus :: Failed => {
1090- log_debug ! ( logger, "Saving updated payment" ) ;
10911089 let hash = updated_invoice. payment_hash . into_32 ( ) ;
10921090 let inbound = updated_invoice. inbound ;
1093- let mut payment_info = PaymentInfo :: from ( updated_invoice) ;
1094- payment_info. last_update = now ( ) . as_secs ( ) ;
1091+ updated_invoice. last_updated = now ( ) . as_secs ( ) ;
1092+ let payment_info = PaymentInfo :: from ( updated_invoice. clone ( ) ) ;
1093+ log_debug ! (
1094+ logger,
1095+ "Saving updated payment: {} {}" ,
1096+ hash. to_lower_hex_string( ) ,
1097+ payment_info. last_update
1098+ ) ;
10951099 persist_payment_info ( & storage, & hash, & payment_info, inbound) ?;
10961100 }
10971101 HTLCStatus :: Pending | HTLCStatus :: InFlight => ( ) ,
10981102 }
10991103
1100- Ok ( ( ) )
1104+ Ok ( updated_invoice )
11011105}
11021106
11031107impl < S : MutinyStorage > FedimintClient for FederationClient < S > {
0 commit comments