@@ -6372,7 +6372,7 @@ where
63726372
63736373 // Returns whether or not we need to re-persist.
63746374 fn internal_process_pending_htlc_forwards(&self) -> NotifyOption {
6375- let should_persist = NotifyOption::DoPersist ;
6375+ let mut should_persist = NotifyOption::SkipPersistNoEvents ;
63766376 self.process_pending_update_add_htlcs();
63776377
63786378 let mut new_events = VecDeque::new();
@@ -6383,6 +6383,7 @@ where
63836383 mem::swap(&mut forward_htlcs, &mut self.forward_htlcs.lock().unwrap());
63846384
63856385 for (short_chan_id, mut pending_forwards) in forward_htlcs {
6386+ should_persist = NotifyOption::DoPersist;
63866387 if short_chan_id != 0 {
63876388 self.process_forward_htlcs(
63886389 short_chan_id,
@@ -6400,7 +6401,7 @@ where
64006401 }
64016402
64026403 let best_block_height = self.best_block.read().unwrap().height;
6403- self.pending_outbound_payments.check_retry_payments(
6404+ let needs_persist = self.pending_outbound_payments.check_retry_payments(
64046405 &self.router,
64056406 || self.list_usable_channels(),
64066407 || self.compute_inflight_htlcs(),
@@ -6411,6 +6412,9 @@ where
64116412 &self.logger,
64126413 |args| self.send_payment_along_path(args),
64136414 );
6415+ if needs_persist {
6416+ should_persist = NotifyOption::DoPersist;
6417+ }
64146418
64156419 for (htlc_source, payment_hash, failure_reason, destination) in failed_forwards.drain(..) {
64166420 self.fail_htlc_backwards_internal(
@@ -6426,13 +6430,17 @@ where
64266430 // next get a `get_and_clear_pending_msg_events` call, but some tests rely on it, and it's
64276431 // nice to do the work now if we can rather than while we're trying to get messages in the
64286432 // network stack.
6429- self.check_free_holding_cells();
6433+ if self.check_free_holding_cells() {
6434+ should_persist = NotifyOption::DoPersist;
6435+ }
64306436
64316437 if new_events.is_empty() {
64326438 return should_persist;
64336439 }
64346440 let mut events = self.pending_events.lock().unwrap();
64356441 events.append(&mut new_events);
6442+ should_persist = NotifyOption::DoPersist;
6443+
64366444 should_persist
64376445 }
64386446
0 commit comments