Add simple utility to ChannelManager to force close all channels
authorMatt Corallo <git@bluematt.me>
Tue, 14 Aug 2018 14:43:34 +0000 (10:43 -0400)
committerMatt Corallo <git@bluematt.me>
Mon, 20 Aug 2018 17:58:31 +0000 (13:58 -0400)
src/ln/channelmanager.rs

index d273be52b8fcc43b4b8a17ddccc3c3a724b61c36..c884f8a1adb9bec87afcd301d170afe0729268d9 100644 (file)
@@ -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]) {
                ({