X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fchannelmanager.rs;h=b7c7e03322725d2d34f957249f1fe049ac18b68f;hb=417e86679241624857c9e3258f1481bce3428b3e;hp=961f25cc664ad3425d39dcf5e099b66c44eb4949;hpb=4a4163fcf4842d7531e8730a6327764277aadf99;p=rust-lightning diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 961f25cc..b7c7e033 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -4472,20 +4472,34 @@ where chan_id: &[u8; 32], chan_context: &mut ChannelContext<::Signer>, unfunded_chan_context: &mut UnfundedChannelContext, + pending_msg_events: &mut Vec, | { chan_context.maybe_expire_prev_config(); if unfunded_chan_context.should_expire_unfunded_channel() { - log_error!(self.logger, "Force-closing pending outbound channel {} for not establishing in a timely manner", log_bytes!(&chan_id[..])); + log_error!(self.logger, + "Force-closing pending channel with ID {} for not establishing in a timely manner", + log_bytes!(&chan_id[..])); update_maps_on_chan_removal!(self, &chan_context); self.issue_channel_close_events(&chan_context, ClosureReason::HolderForceClosed); self.finish_force_close_channel(chan_context.force_shutdown(false)); + pending_msg_events.push(MessageSendEvent::HandleError { + node_id: counterparty_node_id, + action: msgs::ErrorAction::SendErrorMessage { + msg: msgs::ErrorMessage { + channel_id: *chan_id, + data: "Force-closing pending channel due to timeout awaiting establishment handshake".to_owned(), + }, + }, + }); false } else { true } }; - peer_state.outbound_v1_channel_by_id.retain(|chan_id, chan| process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context)); - peer_state.inbound_v1_channel_by_id.retain(|chan_id, chan| process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context)); + peer_state.outbound_v1_channel_by_id.retain(|chan_id, chan| process_unfunded_channel_tick( + chan_id, &mut chan.context, &mut chan.unfunded_context, pending_msg_events)); + peer_state.inbound_v1_channel_by_id.retain(|chan_id, chan| process_unfunded_channel_tick( + chan_id, &mut chan.context, &mut chan.unfunded_context, pending_msg_events)); if peer_state.ok_to_remove(true) { pending_peers_awaiting_removal.push(counterparty_node_id);