@@ -6341,7 +6341,7 @@ where
63416341
63426342 // Returns whether or not we need to re-persist.
63436343 fn internal_process_pending_htlc_forwards(&self) -> NotifyOption {
6344- let should_persist = NotifyOption::DoPersist ;
6344+ let mut should_persist = NotifyOption::SkipPersistNoEvents ;
63456345 self.process_pending_update_add_htlcs();
63466346
63476347 let mut new_events = VecDeque::new();
@@ -6352,6 +6352,7 @@ where
63526352 mem::swap(&mut forward_htlcs, &mut self.forward_htlcs.lock().unwrap());
63536353
63546354 for (short_chan_id, mut pending_forwards) in forward_htlcs {
6355+ should_persist = NotifyOption::DoPersist;
63556356 if short_chan_id != 0 {
63566357 let mut forwarding_counterparty = None;
63576358 macro_rules! forwarding_channel_not_found {
@@ -7112,7 +7113,7 @@ where
71127113 }
71137114
71147115 let best_block_height = self.best_block.read().unwrap().height;
7115- self.pending_outbound_payments.check_retry_payments(
7116+ let needs_persist = self.pending_outbound_payments.check_retry_payments(
71167117 &self.router,
71177118 || self.list_usable_channels(),
71187119 || self.compute_inflight_htlcs(),
@@ -7123,6 +7124,9 @@ where
71237124 &self.logger,
71247125 |args| self.send_payment_along_path(args),
71257126 );
7127+ if needs_persist {
7128+ should_persist = NotifyOption::DoPersist;
7129+ }
71267130
71277131 for (htlc_source, payment_hash, failure_reason, destination) in failed_forwards.drain(..) {
71287132 self.fail_htlc_backwards_internal(
@@ -7138,13 +7142,17 @@ where
71387142 // next get a `get_and_clear_pending_msg_events` call, but some tests rely on it, and it's
71397143 // nice to do the work now if we can rather than while we're trying to get messages in the
71407144 // network stack.
7141- self.check_free_holding_cells();
7145+ if self.check_free_holding_cells() {
7146+ should_persist = NotifyOption::DoPersist;
7147+ }
71427148
71437149 if new_events.is_empty() {
71447150 return should_persist;
71457151 }
71467152 let mut events = self.pending_events.lock().unwrap();
71477153 events.append(&mut new_events);
7154+ should_persist = NotifyOption::DoPersist;
7155+
71487156 should_persist
71497157 }
71507158
0 commit comments