Skip to content

Commit

Permalink
Add payment_hash to MsgHandleErrInternal
Browse files Browse the repository at this point in the history
  • Loading branch information
jbesraa committed May 9, 2024
1 parent fe7f548 commit 4b89261
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ struct MsgHandleErrInternal {
err: msgs::LightningError,
closes_channel: bool,
shutdown_finish: Option<(ShutdownResult, Option<msgs::ChannelUpdate>)>,
payment_hash: Option<PaymentHash>
}
impl MsgHandleErrInternal {
#[inline]
Expand All @@ -594,11 +595,12 @@ impl MsgHandleErrInternal {
},
closes_channel: false,
shutdown_finish: None,
payment_hash: None
}
}
#[inline]
fn from_no_close(err: msgs::LightningError) -> Self {
Self { err, closes_channel: false, shutdown_finish: None }
Self { err, closes_channel: false, shutdown_finish: None, payment_hash: None }
}
#[inline]
fn from_finish_shutdown(err: String, channel_id: ChannelId, shutdown_res: ShutdownResult, channel_update: Option<msgs::ChannelUpdate>) -> Self {
Expand All @@ -615,6 +617,7 @@ impl MsgHandleErrInternal {
err: LightningError { err, action },
closes_channel: true,
shutdown_finish: Some((shutdown_res, channel_update)),
payment_hash: None
}
}
#[inline]
Expand Down Expand Up @@ -647,6 +650,7 @@ impl MsgHandleErrInternal {
},
closes_channel: false,
shutdown_finish: None,
payment_hash: None
}
}

Expand Down Expand Up @@ -2683,14 +2687,14 @@ macro_rules! handle_error {

match $internal {
Ok(msg) => Ok(msg),
Err(MsgHandleErrInternal { err, shutdown_finish, .. }) => {
Err(MsgHandleErrInternal { err, shutdown_finish, payment_hash, .. }) => {
let mut msg_event = None;

if let Some((shutdown_res, update_option)) = shutdown_finish {
let counterparty_node_id = shutdown_res.counterparty_node_id;
let channel_id = shutdown_res.channel_id;
let logger = WithContext::from(
&$self.logger, Some(counterparty_node_id), Some(channel_id), None
&$self.logger, Some(counterparty_node_id), Some(channel_id), payment_hash
);
log_error!(logger, "Force-closing channel: {}", err.err);

Expand Down

0 comments on commit 4b89261

Please sign in to comment.