Free the holding cells during background timer ticks
[rust-lightning] / lightning / src / ln / channelmanager.rs
index fdd0bb202417ba5f62d1a339bb001633db9ade68..d01ff8b1921cc53ce0e0f3f64864441cc5f13790 100644 (file)
@@ -3817,6 +3817,13 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
 
                        self.remove_stale_resolved_payments();
 
+                       // Technically we don't need to do this here, but if we have holding cell entries in a
+                       // channel that need freeing, it's better to do that here and block a background task
+                       // than block the message queueing pipeline.
+                       if self.check_free_holding_cells() {
+                               should_persist = NotifyOption::DoPersist;
+                       }
+
                        should_persist
                });
        }