@@ -6363,7 +6363,7 @@ where
63636363
63646364 // Returns whether or not we need to re-persist.
63656365 fn internal_process_pending_htlc_forwards(&self) -> NotifyOption {
6366- let should_persist = NotifyOption::DoPersist ;
6366+ let mut should_persist = NotifyOption::SkipPersistNoEvents ;
63676367 self.process_pending_update_add_htlcs();
63686368
63696369 let mut new_events = VecDeque::new();
@@ -6374,6 +6374,7 @@ where
63746374 mem::swap(&mut forward_htlcs, &mut self.forward_htlcs.lock().unwrap());
63756375
63766376 for (short_chan_id, mut pending_forwards) in forward_htlcs {
6377+ should_persist = NotifyOption::DoPersist;
63776378 if short_chan_id != 0 {
63786379 self.process_forward_htlcs(
63796380 short_chan_id,
@@ -6391,7 +6392,7 @@ where
63916392 }
63926393
63936394 let best_block_height = self.best_block.read().unwrap().height;
6394- self.pending_outbound_payments.check_retry_payments(
6395+ let needs_persist = self.pending_outbound_payments.check_retry_payments(
63956396 &self.router,
63966397 || self.list_usable_channels(),
63976398 || self.compute_inflight_htlcs(),
@@ -6402,6 +6403,9 @@ where
64026403 &self.logger,
64036404 |args| self.send_payment_along_path(args),
64046405 );
6406+ if needs_persist {
6407+ should_persist = NotifyOption::DoPersist;
6408+ }
64056409
64066410 for (htlc_source, payment_hash, failure_reason, destination) in failed_forwards.drain(..) {
64076411 self.fail_htlc_backwards_internal(
@@ -6417,13 +6421,17 @@ where
64176421 // next get a `get_and_clear_pending_msg_events` call, but some tests rely on it, and it's
64186422 // nice to do the work now if we can rather than while we're trying to get messages in the
64196423 // network stack.
6420- self.check_free_holding_cells();
6424+ if self.check_free_holding_cells() {
6425+ should_persist = NotifyOption::DoPersist;
6426+ }
64216427
64226428 if new_events.is_empty() {
64236429 return should_persist;
64246430 }
64256431 let mut events = self.pending_events.lock().unwrap();
64266432 events.append(&mut new_events);
6433+ should_persist = NotifyOption::DoPersist;
6434+
64276435 should_persist
64286436 }
64296437
0 commit comments