@@ -4472,20 +4472,34 @@ where
44724472 chan_id: &[u8; 32],
44734473 chan_context: &mut ChannelContext<<SP::Target as SignerProvider>::Signer>,
44744474 unfunded_chan_context: &mut UnfundedChannelContext,
4475+ pending_msg_events: &mut Vec<MessageSendEvent>,
44754476 | {
44764477 chan_context.maybe_expire_prev_config();
44774478 if unfunded_chan_context.should_expire_unfunded_channel() {
4478- log_error!(self.logger, "Force-closing pending outbound channel {} for not establishing in a timely manner", log_bytes!(&chan_id[..]));
4479+ log_error!(self.logger,
4480+ "Force-closing pending channel with ID {} for not establishing in a timely manner",
4481+ log_bytes!(&chan_id[..]));
44794482 update_maps_on_chan_removal!(self, &chan_context);
44804483 self.issue_channel_close_events(&chan_context, ClosureReason::HolderForceClosed);
44814484 self.finish_force_close_channel(chan_context.force_shutdown(false));
4485+ pending_msg_events.push(MessageSendEvent::HandleError {
4486+ node_id: counterparty_node_id,
4487+ action: msgs::ErrorAction::SendErrorMessage {
4488+ msg: msgs::ErrorMessage {
4489+ channel_id: *chan_id,
4490+ data: "Force-closing pending channel due to timeout awaiting establishment handshake".to_owned(),
4491+ },
4492+ },
4493+ });
44824494 false
44834495 } else {
44844496 true
44854497 }
44864498 };
4487- peer_state.outbound_v1_channel_by_id.retain(|chan_id, chan| process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context));
4488- peer_state.inbound_v1_channel_by_id.retain(|chan_id, chan| process_unfunded_channel_tick(chan_id, &mut chan.context, &mut chan.unfunded_context));
4499+ peer_state.outbound_v1_channel_by_id.retain(|chan_id, chan| process_unfunded_channel_tick(
4500+ chan_id, &mut chan.context, &mut chan.unfunded_context, pending_msg_events));
4501+ peer_state.inbound_v1_channel_by_id.retain(|chan_id, chan| process_unfunded_channel_tick(
4502+ chan_id, &mut chan.context, &mut chan.unfunded_context, pending_msg_events));
44894503
44904504 if peer_state.ok_to_remove(true) {
44914505 pending_peers_awaiting_removal.push(counterparty_node_id);
0 commit comments