Skip to content

Commit 6af9bf9

Browse files
committed
Add MessageSendEvent for ClosingComplete and ClosingSig
1 parent a3c0651 commit 6af9bf9

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11712,6 +11712,8 @@ where
1171211712
&MessageSendEvent::UpdateHTLCs { .. } => false,
1171311713
&MessageSendEvent::SendRevokeAndACK { .. } => false,
1171411714
&MessageSendEvent::SendClosingSigned { .. } => false,
11715+
&MessageSendEvent::SendClosingComplete { .. } => false,
11716+
&MessageSendEvent::SendClosingSig { .. } => false,
1171511717
&MessageSendEvent::SendShutdown { .. } => false,
1171611718
&MessageSendEvent::SendChannelReestablish { .. } => false,
1171711719
&MessageSendEvent::HandleError { .. } => false,

lightning/src/ln/functional_test_utils.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,12 @@ pub fn remove_first_msg_event_to_node(msg_node_id: &PublicKey, msg_events: &mut
937937
MessageSendEvent::SendClosingSigned { node_id, .. } => {
938938
node_id == msg_node_id
939939
},
940+
MessageSendEvent::SendClosingComplete { node_id, .. } => {
941+
node_id == msg_node_id
942+
},
943+
MessageSendEvent::SendClosingSig { node_id, .. } => {
944+
node_id == msg_node_id
945+
},
940946
MessageSendEvent::SendShutdown { node_id, .. } => {
941947
node_id == msg_node_id
942948
},

lightning/src/ln/msgs.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,6 +1772,20 @@ pub enum MessageSendEvent {
17721772
/// The message which should be sent.
17731773
msg: ClosingSigned,
17741774
},
1775+
/// Used to indicate that a `closing_complete` message should be sent to the peer with the given `node_id`.
1776+
SendClosingComplete {
1777+
/// The node_id of the node which should receive this message
1778+
node_id: PublicKey,
1779+
/// The message which should be sent.
1780+
msg: ClosingComplete,
1781+
},
1782+
/// Used to indicate that a `closing_sig` message should be sent to the peer with the given `node_id`.
1783+
SendClosingSig {
1784+
/// The node_id of the node which should receive this message
1785+
node_id: PublicKey,
1786+
/// The message which should be sent.
1787+
msg: ClosingSig,
1788+
},
17751789
/// Used to indicate that a shutdown message should be sent to the peer with the given node_id.
17761790
SendShutdown {
17771791
/// The node_id of the node which should receive this message

lightning/src/ln/peer_handler.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2557,6 +2557,18 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
25572557
&msg.channel_id);
25582558
self.enqueue_message(&mut *get_peer_for_forwarding!(node_id)?, msg);
25592559
},
2560+
MessageSendEvent::SendClosingComplete { ref node_id, ref msg } => {
2561+
log_debug!(WithContext::from(&self.logger, Some(*node_id), Some(msg.channel_id), None), "Handling SendClosingComplete event in peer_handler for node {} for channel {}",
2562+
log_pubkey!(node_id),
2563+
&msg.channel_id);
2564+
self.enqueue_message(&mut *get_peer_for_forwarding!(node_id)?, msg);
2565+
},
2566+
MessageSendEvent::SendClosingSig { ref node_id, ref msg } => {
2567+
log_debug!(WithContext::from(&self.logger, Some(*node_id), Some(msg.channel_id), None), "Handling SendClosingSig event in peer_handler for node {} for channel {}",
2568+
log_pubkey!(node_id),
2569+
&msg.channel_id);
2570+
self.enqueue_message(&mut *get_peer_for_forwarding!(node_id)?, msg);
2571+
},
25602572
MessageSendEvent::SendShutdown { ref node_id, ref msg } => {
25612573
log_debug!(WithContext::from(&self.logger, Some(*node_id), Some(msg.channel_id), None), "Handling Shutdown event in peer_handler for node {} for channel {}",
25622574
log_pubkey!(node_id),

0 commit comments

Comments
 (0)