From f476a19bde05ea01d0c99a5dad4915d8e835aad2 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 14 Aug 2018 10:43:34 -0400 Subject: [PATCH] Add simple utility to ChannelManager to force close all channels --- src/ln/channelmanager.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ln/channelmanager.rs b/src/ln/channelmanager.rs index d273be52b..c884f8a1a 100644 --- a/src/ln/channelmanager.rs +++ b/src/ln/channelmanager.rs @@ -415,6 +415,14 @@ impl ChannelManager { } } + /// Force close all channels, immediately broadcasting the latest local commitment transaction + /// for each to the chain and rejecting new HTLCs on each. + pub fn force_close_all_channels(&self) { + for chan in self.list_channels() { + self.force_close_channel(&chan.channel_id); + } + } + #[inline] fn gen_rho_mu_from_shared_secret(shared_secret: &SharedSecret) -> ([u8; 32], [u8; 32]) { ({ -- 2.39.5