Skip to content

Commit f1177dc

Browse files
committed
Free the holding cells during background timer ticks
We currently free the channel holding cells in `get_and_clear_pending_msg_events`, blocking outbound messages while we do so. This is fine, but may block the message pipeline longer than we need to. In the next commit we'll push timer-originating channel fee updates out through the holding cell pipeline, leaning more on that freeing in the future. Thus, to avoid a regression in message time, here we clear the holding cell after processing all timer events. This also avoids needing to change tests in the next commit.
1 parent 0954526 commit f1177dc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3779,6 +3779,13 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
37793779

37803780
self.remove_stale_resolved_payments();
37813781

3782+
// Technically we don't need to do this here, but if we have holding cell entries in a
3783+
// channel that need freeing, it's better to do that here and block a background task
3784+
// rather than blocking the message queueing pipeline.
3785+
if self.check_free_holding_cells() {
3786+
should_persist = NotifyOption::DoPersist;
3787+
}
3788+
37823789
should_persist
37833790
});
37843791
}

0 commit comments

Comments
 (0)