From: Matt Corallo Date: Tue, 14 Aug 2018 14:43:34 +0000 (-0400) Subject: Add simple utility to ChannelManager to force close all channels X-Git-Tag: v0.0.12~345^2~4 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=f476a19bde05ea01d0c99a5dad4915d8e835aad2;p=rust-lightning Add simple utility to ChannelManager to force close all channels --- diff --git a/src/ln/channelmanager.rs b/src/ln/channelmanager.rs index d273be52..c884f8a1 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]) { ({