@@ -6333,7 +6333,7 @@ where
63336333
63346334 // Returns whether or not we need to re-persist.
63356335 fn internal_process_pending_htlc_forwards(&self) -> NotifyOption {
6336- let should_persist = NotifyOption::DoPersist ;
6336+ let mut should_persist = NotifyOption::SkipPersistNoEvents ;
63376337 self.process_pending_update_add_htlcs();
63386338
63396339 let mut new_events = VecDeque::new();
@@ -6343,6 +6343,7 @@ where
63436343 mem::swap(&mut forward_htlcs, &mut self.forward_htlcs.lock().unwrap());
63446344
63456345 for (short_chan_id, mut pending_forwards) in forward_htlcs {
6346+ should_persist = NotifyOption::DoPersist;
63466347 if short_chan_id != 0 {
63476348 self.process_forward_htlcs(
63486349 short_chan_id,
@@ -6360,7 +6361,7 @@ where
63606361 }
63616362
63626363 let best_block_height = self.best_block.read().unwrap().height;
6363- self.pending_outbound_payments.check_retry_payments(
6364+ let needs_persist = self.pending_outbound_payments.check_retry_payments(
63646365 &self.router,
63656366 || self.list_usable_channels(),
63666367 || self.compute_inflight_htlcs(),
@@ -6371,6 +6372,9 @@ where
63716372 &self.logger,
63726373 |args| self.send_payment_along_path(args),
63736374 );
6375+ if needs_persist {
6376+ should_persist = NotifyOption::DoPersist;
6377+ }
63746378
63756379 for (htlc_source, payment_hash, failure_reason, destination) in failed_forwards.drain(..) {
63766380 self.fail_htlc_backwards_internal(
@@ -6386,13 +6390,17 @@ where
63866390 // next get a `get_and_clear_pending_msg_events` call, but some tests rely on it, and it's
63876391 // nice to do the work now if we can rather than while we're trying to get messages in the
63886392 // network stack.
6389- self.check_free_holding_cells();
6393+ if self.check_free_holding_cells() {
6394+ should_persist = NotifyOption::DoPersist;
6395+ }
63906396
63916397 if new_events.is_empty() {
63926398 return should_persist;
63936399 }
63946400 let mut events = self.pending_events.lock().unwrap();
63956401 events.append(&mut new_events);
6402+ should_persist = NotifyOption::DoPersist;
6403+
63966404 should_persist
63976405 }
63986406
0 commit comments