@@ -6124,7 +6124,8 @@ where
6124
6124
Ok(())
6125
6125
}
6126
6126
6127
- pub(crate) fn process_pending_update_add_htlcs(&self) {
6127
+ pub(crate) fn process_pending_update_add_htlcs(&self) -> bool {
6128
+ let mut should_persist = false;
6128
6129
let mut decode_update_add_htlcs = new_hash_map();
6129
6130
mem::swap(&mut decode_update_add_htlcs, &mut self.decode_update_add_htlcs.lock().unwrap());
6130
6131
@@ -6147,6 +6148,8 @@ where
6147
6148
};
6148
6149
6149
6150
'outer_loop: for (incoming_scid, update_add_htlcs) in decode_update_add_htlcs {
6151
+ // If any decoded update_add_htlcs were processed, we need to persist.
6152
+ should_persist = true;
6150
6153
let incoming_channel_details_opt =
6151
6154
self.do_funded_channel_callback(incoming_scid, |chan: &mut FundedChannel<SP>| {
6152
6155
let counterparty_node_id = chan.context.get_counterparty_node_id();
@@ -6310,6 +6313,7 @@ where
6310
6313
));
6311
6314
}
6312
6315
}
6316
+ should_persist
6313
6317
}
6314
6318
6315
6319
/// Returns whether we have pending HTLC forwards that need to be processed via
@@ -6342,7 +6346,10 @@ where
6342
6346
// Returns whether or not we need to re-persist.
6343
6347
fn internal_process_pending_htlc_forwards(&self) -> NotifyOption {
6344
6348
let mut should_persist = NotifyOption::SkipPersistNoEvents;
6345
- self.process_pending_update_add_htlcs();
6349
+
6350
+ if self.process_pending_update_add_htlcs() {
6351
+ should_persist = NotifyOption::DoPersist;
6352
+ }
6346
6353
6347
6354
let mut new_events = VecDeque::new();
6348
6355
let mut failed_forwards = Vec::new();
0 commit comments