@@ -6332,7 +6332,7 @@ where
63326332
63336333 // Returns whether or not we need to re-persist.
63346334 fn internal_process_pending_htlc_forwards(&self) -> NotifyOption {
6335- let should_persist = NotifyOption::DoPersist ;
6335+ let mut should_persist = NotifyOption::SkipPersistNoEvents ;
63366336 self.process_pending_update_add_htlcs();
63376337
63386338 let mut new_events = VecDeque::new();
@@ -6342,6 +6342,7 @@ where
63426342 mem::swap(&mut forward_htlcs, &mut self.forward_htlcs.lock().unwrap());
63436343
63446344 for (short_chan_id, mut pending_forwards) in forward_htlcs {
6345+ should_persist = NotifyOption::DoPersist;
63456346 if short_chan_id != 0 {
63466347 self.process_forward_htlcs(
63476348 short_chan_id,
@@ -6359,7 +6360,7 @@ where
63596360 }
63606361
63616362 let best_block_height = self.best_block.read().unwrap().height;
6362- self.pending_outbound_payments.check_retry_payments(
6363+ let needs_persist = self.pending_outbound_payments.check_retry_payments(
63636364 &self.router,
63646365 || self.list_usable_channels(),
63656366 || self.compute_inflight_htlcs(),
@@ -6370,6 +6371,9 @@ where
63706371 &self.logger,
63716372 |args| self.send_payment_along_path(args),
63726373 );
6374+ if needs_persist {
6375+ should_persist = NotifyOption::DoPersist;
6376+ }
63736377
63746378 for (htlc_source, payment_hash, failure_reason, destination) in failed_forwards.drain(..) {
63756379 self.fail_htlc_backwards_internal(
@@ -6385,13 +6389,17 @@ where
63856389 // next get a `get_and_clear_pending_msg_events` call, but some tests rely on it, and it's
63866390 // nice to do the work now if we can rather than while we're trying to get messages in the
63876391 // network stack.
6388- self.check_free_holding_cells();
6392+ if self.check_free_holding_cells() {
6393+ should_persist = NotifyOption::DoPersist;
6394+ }
63896395
63906396 if new_events.is_empty() {
63916397 return should_persist;
63926398 }
63936399 let mut events = self.pending_events.lock().unwrap();
63946400 events.append(&mut new_events);
6401+ should_persist = NotifyOption::DoPersist;
6402+
63956403 should_persist
63966404 }
63976405
0 commit comments