Refactor out first-closing-sent creation
[rust-lightning] / src / ln / channelmanager.rs
index ed69e8a033f1aed61cc14c305a80fe4793f14457..400edf8c2c70ad3ba12171749c53ea68f65637da 100644 (file)
@@ -1233,6 +1233,9 @@ impl ChannelManager {
 
        /// Call this upon creation of a funding transaction for the given channel.
        ///
+       /// Note that ALL inputs in the transaction pointed to by funding_txo MUST spend SegWit outputs
+       /// or your counterparty can steal your funds!
+       ///
        /// Panics if a funding transaction has already been provided for this channel.
        ///
        /// May panic if the funding_txo is duplicative with some other channel (note that this should
@@ -1832,7 +1835,7 @@ impl ChannelManager {
                                                //TODO: here and below MsgHandleErrInternal, #153 case
                                                return Err(MsgHandleErrInternal::send_err_msg_no_close("Got a message for a channel from the wrong node!", msg.channel_id));
                                        }
-                                       let (shutdown, closing_signed, dropped_htlcs) = chan_entry.get_mut().shutdown(&*self.fee_estimator, &msg).map_err(|e| MsgHandleErrInternal::from_maybe_close(e))?;
+                                       let (shutdown, closing_signed, dropped_htlcs) = chan_entry.get_mut().shutdown(&*self.fee_estimator, &msg).map_err(|e| MsgHandleErrInternal::from_chan_maybe_close(e, msg.channel_id))?;
                                        if let Some(msg) = shutdown {
                                                channel_state.pending_msg_events.push(events::MessageSendEvent::SendShutdown {
                                                        node_id: their_node_id.clone(),