@@ -574,7 +574,9 @@ impl MsgHandleErrInternal {
574
574
Self { err, chan_id: None, shutdown_finish: None, channel_capacity: None, channel_funding_txo: None }
575
575
}
576
576
#[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
+ {
578
580
let err_msg = msgs::ErrorMessage { channel_id, data: err.clone() };
579
581
let action = if shutdown_res.monitor_update.is_some() {
580
582
// We have a closing `ChannelMonitorUpdate`, which means the channel was funded and we
@@ -586,10 +588,10 @@ impl MsgHandleErrInternal {
586
588
};
587
589
Self {
588
590
err: LightningError { err, action },
589
- chan_id: Some((channel_id, user_channel_id )),
591
+ chan_id: Some((channel_id, channel_context.get_user_id() )),
590
592
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() ,
593
595
}
594
596
}
595
597
#[inline]
@@ -2045,12 +2047,9 @@ macro_rules! convert_chan_phase_err {
2045
2047
log_error!(logger, "Closing channel {} due to close-required error: {}", $channel_id, msg);
2046
2048
update_maps_on_chan_removal!($self, $channel.context);
2047
2049
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();
2051
2050
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 ))
2054
2053
},
2055
2054
}
2056
2055
};
@@ -3764,12 +3763,9 @@ where
3764
3763
let logger = WithChannelContext::from(&self.logger, &chan.context);
3765
3764
let funding_res = chan.get_funding_created(funding_transaction, funding_txo, is_batch_funding, &&logger)
3766
3765
.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();
3769
3766
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)
3773
3769
} else { unreachable!(); });
3774
3770
match funding_res {
3775
3771
Ok(funding_msg) => (chan, funding_msg),
0 commit comments