Skip to content

Commit 80054a0

Browse files
committed
f Also persist for process_pending_update_add_htlcs
1 parent 3fd1855 commit 80054a0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6124,7 +6124,8 @@ where
61246124
Ok(())
61256125
}
61266126

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;
61286129
let mut decode_update_add_htlcs = new_hash_map();
61296130
mem::swap(&mut decode_update_add_htlcs, &mut self.decode_update_add_htlcs.lock().unwrap());
61306131

@@ -6147,6 +6148,8 @@ where
61476148
};
61486149

61496150
'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;
61506153
let incoming_channel_details_opt =
61516154
self.do_funded_channel_callback(incoming_scid, |chan: &mut FundedChannel<SP>| {
61526155
let counterparty_node_id = chan.context.get_counterparty_node_id();
@@ -6310,6 +6313,7 @@ where
63106313
));
63116314
}
63126315
}
6316+
should_persist
63136317
}
63146318

63156319
/// Returns whether we have pending HTLC forwards that need to be processed via
@@ -6342,7 +6346,10 @@ where
63426346
// Returns whether or not we need to re-persist.
63436347
fn internal_process_pending_htlc_forwards(&self) -> NotifyOption {
63446348
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+
}
63466353

63476354
let mut new_events = VecDeque::new();
63486355
let mut failed_forwards = Vec::new();

0 commit comments

Comments
 (0)