@@ -574,7 +574,9 @@ impl MsgHandleErrInternal {
574574 Self { err, chan_id: None, shutdown_finish: None, channel_capacity: None, channel_funding_txo: None }
575575 }
576576 #[inline]
577- fn from_finish_shutdown(err: String, channel_id: ChannelId, user_channel_id: u128, shutdown_res: ShutdownResult, channel_update: Option<msgs::ChannelUpdate>, channel_capacity: u64, channel_funding_txo: Option<OutPoint>) -> Self {
577+ fn from_finish_shutdown<SP: Deref>(err: String, channel_id: ChannelId, shutdown_res: ShutdownResult, channel_update: Option<msgs::ChannelUpdate>, channel_context: &ChannelContext<SP>) -> Self
578+ where SP::Target: SignerProvider
579+ {
578580 let err_msg = msgs::ErrorMessage { channel_id, data: err.clone() };
579581 let action = if shutdown_res.monitor_update.is_some() {
580582 // We have a closing `ChannelMonitorUpdate`, which means the channel was funded and we
@@ -586,10 +588,10 @@ impl MsgHandleErrInternal {
586588 };
587589 Self {
588590 err: LightningError { err, action },
589- chan_id: Some((channel_id, user_channel_id )),
591+ chan_id: Some((channel_id, channel_context.get_user_id() )),
590592 shutdown_finish: Some((shutdown_res, channel_update)),
591- channel_capacity: Some(channel_capacity ),
592- channel_funding_txo: channel_funding_txo ,
593+ channel_capacity: Some(channel_context.get_value_satoshis() ),
594+ channel_funding_txo: channel_context.get_funding_txo() ,
593595 }
594596 }
595597 #[inline]
@@ -2045,12 +2047,9 @@ macro_rules! convert_chan_phase_err {
20452047 log_error!(logger, "Closing channel {} due to close-required error: {}", $channel_id, msg);
20462048 update_maps_on_chan_removal!($self, $channel.context);
20472049 let shutdown_res = $channel.context.force_shutdown(true);
2048- let user_id = $channel.context.get_user_id();
2049- let channel_capacity_satoshis = $channel.context.get_value_satoshis();
2050- let channel_funding_txo = $channel.context.get_funding_txo();
20512050
2052- (true, MsgHandleErrInternal::from_finish_shutdown(msg, *$channel_id, user_id,
2053- shutdown_res, $channel_update, channel_capacity_satoshis, channel_funding_txo ))
2051+ (true, MsgHandleErrInternal::from_finish_shutdown(msg, *$channel_id,
2052+ shutdown_res, $channel_update, &$channel.context ))
20542053 },
20552054 }
20562055 };
@@ -3764,12 +3763,9 @@ where
37643763 let logger = WithChannelContext::from(&self.logger, &chan.context);
37653764 let funding_res = chan.get_funding_created(funding_transaction, funding_txo, is_batch_funding, &&logger)
37663765 .map_err(|(mut chan, e)| if let ChannelError::Close(msg) = e {
3767- let channel_id = chan.context.channel_id();
3768- let user_id = chan.context.get_user_id();
37693766 let shutdown_res = chan.context.force_shutdown(false);
3770- let channel_capacity = chan.context.get_value_satoshis();
3771- let channel_funding_txo = chan.context.get_funding_txo();
3772- (chan, MsgHandleErrInternal::from_finish_shutdown(msg, channel_id, user_id, shutdown_res, None, channel_capacity, channel_funding_txo))
3767+ let err_msg = MsgHandleErrInternal::from_finish_shutdown(msg, chan.context.channel_id(), shutdown_res, None, &chan.context);
3768+ (chan, err_msg)
37733769 } else { unreachable!(); });
37743770 match funding_res {
37753771 Ok(funding_msg) => (chan, funding_msg),
0 commit comments