X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fchain%2Fchannelmonitor.rs;h=6c11703d3158fc86567a49b2c81d771a1b8517b0;hb=ecb0b842416dcf6fba0174ad5fcc173b3001825c;hp=fd097f30cc200cf6318297294cdc6867bd62970f;hpb=1c449a39f4e6abf71e657f1f38827cc68a30e156;p=rust-lightning diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index fd097f30..6c11703d 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -438,6 +438,9 @@ pub(crate) enum ChannelMonitorUpdateStep { /// think we've fallen behind! should_broadcast: bool, }, + ShutdownScript { + scriptpubkey: Script, + }, } impl_writeable_tlv_based_enum!(ChannelMonitorUpdateStep, @@ -461,6 +464,9 @@ impl_writeable_tlv_based_enum!(ChannelMonitorUpdateStep, (4, ChannelForceClosed) => { (0, should_broadcast, required), }, + (5, ShutdownScript) => { + (0, scriptpubkey, required), + }, ;); /// A ChannelMonitor handles chain events (blocks connected and disconnected) and generates @@ -1437,7 +1443,13 @@ impl ChannelMonitorImpl { // shouldn't print the scary warning above. log_info!(logger, "Channel off-chain state closed after we broadcasted our latest commitment transaction."); } - } + }, + ChannelMonitorUpdateStep::ShutdownScript { scriptpubkey } => { + log_trace!(logger, "Updating ChannelMonitor with shutdown script"); + if let Some(shutdown_script) = self.shutdown_script.replace(scriptpubkey.clone()) { + panic!("Attempted to replace shutdown script {} with {}", shutdown_script, scriptpubkey); + } + }, } } self.latest_update_id = updates.update_id;