Skip to content

Commit fb9706f

Browse files
committed
Add new wire messaging and events but don't handle them
1 parent 77c92b3 commit fb9706f

File tree

7 files changed

+436
-1
lines changed

7 files changed

+436
-1
lines changed

lightning-net-tokio/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,17 @@ mod tests {
602602
fn handle_update_fee(&self, _their_node_id: &PublicKey, _msg: &UpdateFee) {}
603603
fn handle_announcement_signatures(&self, _their_node_id: &PublicKey, _msg: &AnnouncementSignatures) {}
604604
fn handle_channel_update(&self, _their_node_id: &PublicKey, _msg: &ChannelUpdate) {}
605+
fn handle_open_channel_v2(&self, _their_node_id: &PublicKey, _their_features: InitFeatures, _msg: &OpenChannelV2) {}
606+
fn handle_accept_channel_v2(&self, _their_node_id: &PublicKey, _their_features: InitFeatures, _msg: &AcceptChannelV2) {}
607+
fn handle_tx_add_input(&self, _their_node_id: &PublicKey, _msg: &TxAddInput) {}
608+
fn handle_tx_add_output(&self, _their_node_id: &PublicKey, _msg: &TxAddOutput) {}
609+
fn handle_tx_remove_input(&self, _their_node_id: &PublicKey, _msg: &TxRemoveInput) {}
610+
fn handle_tx_remove_output(&self, _their_node_id: &PublicKey, _msg: &TxRemoveOutput) {}
611+
fn handle_tx_complete(&self, _their_node_id: &PublicKey, _msg: &TxComplete) {}
612+
fn handle_tx_signatures(&self, _their_node_id: &PublicKey, _msg: &TxSignatures) {}
613+
fn handle_tx_init_rbf(&self, _their_node_id: &PublicKey, _msg: &TxInitRbf) {}
614+
fn handle_tx_ack_rbf(&self, _their_node_id: &PublicKey, _msg: &TxAckRbf) {}
615+
fn handle_tx_abort(&self, _their_node_id: &PublicKey, _msg: &TxAbort) {}
605616
fn peer_disconnected(&self, their_node_id: &PublicKey, _no_connection_possible: bool) {
606617
if *their_node_id == self.expected_pubkey {
607618
self.disconnected_flag.store(true, Ordering::SeqCst);

lightning/src/ln/channelmanager.rs

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6100,11 +6100,23 @@ impl<M: Deref , T: Deref , K: Deref , F: Deref , L: Deref >
61006100
let _ = handle_error!(self, self.internal_open_channel(counterparty_node_id, their_features, msg), *counterparty_node_id);
61016101
}
61026102

6103+
fn handle_open_channel_v2(&self, counterparty_node_id: &PublicKey, _their_features: InitFeatures, msg: &msgs::OpenChannelV2) {
6104+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
6105+
"Dual-funded channels not supported".to_owned(),
6106+
msg.temporary_channel_id.clone())), *counterparty_node_id);
6107+
}
6108+
61036109
fn handle_accept_channel(&self, counterparty_node_id: &PublicKey, their_features: InitFeatures, msg: &msgs::AcceptChannel) {
61046110
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(&self.total_consistency_lock, &self.persistence_notifier);
61056111
let _ = handle_error!(self, self.internal_accept_channel(counterparty_node_id, their_features, msg), *counterparty_node_id);
61066112
}
61076113

6114+
fn handle_accept_channel_v2(&self, counterparty_node_id: &PublicKey, _their_features: InitFeatures, msg: &msgs::AcceptChannelV2) {
6115+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
6116+
"Dual-funded channels not supported".to_owned(),
6117+
msg.temporary_channel_id.clone())), *counterparty_node_id);
6118+
}
6119+
61086120
fn handle_funding_created(&self, counterparty_node_id: &PublicKey, msg: &msgs::FundingCreated) {
61096121
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(&self.total_consistency_lock, &self.persistence_notifier);
61106122
let _ = handle_error!(self, self.internal_funding_created(counterparty_node_id, msg), *counterparty_node_id);
@@ -6211,10 +6223,21 @@ impl<M: Deref , T: Deref , K: Deref , F: Deref , L: Deref >
62116223
pending_msg_events.retain(|msg| {
62126224
match msg {
62136225
&events::MessageSendEvent::SendAcceptChannel { ref node_id, .. } => node_id != counterparty_node_id,
6226+
&events::MessageSendEvent::SendAcceptChannelV2 { ref node_id, .. } => node_id != counterparty_node_id,
62146227
&events::MessageSendEvent::SendOpenChannel { ref node_id, .. } => node_id != counterparty_node_id,
6228+
&events::MessageSendEvent::SendOpenChannelV2 { ref node_id, .. } => node_id != counterparty_node_id,
62156229
&events::MessageSendEvent::SendFundingCreated { ref node_id, .. } => node_id != counterparty_node_id,
62166230
&events::MessageSendEvent::SendFundingSigned { ref node_id, .. } => node_id != counterparty_node_id,
62176231
&events::MessageSendEvent::SendChannelReady { ref node_id, .. } => node_id != counterparty_node_id,
6232+
&events::MessageSendEvent::SendTxAddInput { ref node_id, .. } => node_id != counterparty_node_id,
6233+
&events::MessageSendEvent::SendTxAddOutput { ref node_id, .. } => node_id != counterparty_node_id,
6234+
&events::MessageSendEvent::SendTxRemoveInput { ref node_id, .. } => node_id != counterparty_node_id,
6235+
&events::MessageSendEvent::SendTxRemoveOutput { ref node_id, .. } => node_id != counterparty_node_id,
6236+
&events::MessageSendEvent::SendTxComplete { ref node_id, .. } => node_id != counterparty_node_id,
6237+
&events::MessageSendEvent::SendTxSignatures { ref node_id, .. } => node_id != counterparty_node_id,
6238+
&events::MessageSendEvent::SendTxInitRbf { ref node_id, .. } => node_id != counterparty_node_id,
6239+
&events::MessageSendEvent::SendTxAckRbf { ref node_id, .. } => node_id != counterparty_node_id,
6240+
&events::MessageSendEvent::SendTxAbort { ref node_id, .. } => node_id != counterparty_node_id,
62186241
&events::MessageSendEvent::SendAnnouncementSignatures { ref node_id, .. } => node_id != counterparty_node_id,
62196242
&events::MessageSendEvent::UpdateHTLCs { ref node_id, .. } => node_id != counterparty_node_id,
62206243
&events::MessageSendEvent::SendRevokeAndACK { ref node_id, .. } => node_id != counterparty_node_id,
@@ -6341,6 +6364,60 @@ impl<M: Deref , T: Deref , K: Deref , F: Deref , L: Deref >
63416364
fn provided_init_features(&self, _their_init_features: &PublicKey) -> InitFeatures {
63426365
provided_init_features()
63436366
}
6367+
6368+
fn handle_tx_add_input(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxAddInput) {
6369+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
6370+
"Dual-funded channels not supported".to_owned(),
6371+
msg.channel_id.clone())), *counterparty_node_id);
6372+
}
6373+
6374+
fn handle_tx_add_output(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxAddOutput) {
6375+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
6376+
"Dual-funded channels not supported".to_owned(),
6377+
msg.channel_id.clone())), *counterparty_node_id);
6378+
}
6379+
6380+
fn handle_tx_remove_input(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxRemoveInput) {
6381+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
6382+
"Dual-funded channels not supported".to_owned(),
6383+
msg.channel_id.clone())), *counterparty_node_id);
6384+
}
6385+
6386+
fn handle_tx_remove_output(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxRemoveOutput) {
6387+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
6388+
"Dual-funded channels not supported".to_owned(),
6389+
msg.channel_id.clone())), *counterparty_node_id);
6390+
}
6391+
6392+
fn handle_tx_complete(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxComplete) {
6393+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
6394+
"Dual-funded channels not supported".to_owned(),
6395+
msg.channel_id.clone())), *counterparty_node_id);
6396+
}
6397+
6398+
fn handle_tx_signatures(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxSignatures) {
6399+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
6400+
"Dual-funded channels not supported".to_owned(),
6401+
msg.channel_id.clone())), *counterparty_node_id);
6402+
}
6403+
6404+
fn handle_tx_init_rbf(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxInitRbf) {
6405+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
6406+
"Dual-funded channels not supported".to_owned(),
6407+
msg.channel_id.clone())), *counterparty_node_id);
6408+
}
6409+
6410+
fn handle_tx_ack_rbf(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxAckRbf) {
6411+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
6412+
"Dual-funded channels not supported".to_owned(),
6413+
msg.channel_id.clone())), *counterparty_node_id);
6414+
}
6415+
6416+
fn handle_tx_abort(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxAbort) {
6417+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
6418+
"Dual-funded channels not supported".to_owned(),
6419+
msg.channel_id.clone())), *counterparty_node_id);
6420+
}
63446421
}
63456422

63466423
/// Fetches the set of [`NodeFeatures`] flags which are provided by or required by

lightning/src/ln/msgs.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,8 +1052,12 @@ pub trait ChannelMessageHandler : MessageSendEventsProvider {
10521052
//Channel init:
10531053
/// Handle an incoming open_channel message from the given peer.
10541054
fn handle_open_channel(&self, their_node_id: &PublicKey, their_features: InitFeatures, msg: &OpenChannel);
1055+
/// Handle an incoming open_channel2 message from the given peer.
1056+
fn handle_open_channel_v2(&self, their_node_id: &PublicKey, their_features: InitFeatures, msg: &OpenChannelV2);
10551057
/// Handle an incoming accept_channel message from the given peer.
10561058
fn handle_accept_channel(&self, their_node_id: &PublicKey, their_features: InitFeatures, msg: &AcceptChannel);
1059+
/// Handle an incoming accept_channel2 message from the given peer.
1060+
fn handle_accept_channel_v2(&self, their_node_id: &PublicKey, their_features: InitFeatures, msg: &AcceptChannelV2);
10571061
/// Handle an incoming funding_created message from the given peer.
10581062
fn handle_funding_created(&self, their_node_id: &PublicKey, msg: &FundingCreated);
10591063
/// Handle an incoming funding_signed message from the given peer.
@@ -1067,6 +1071,26 @@ pub trait ChannelMessageHandler : MessageSendEventsProvider {
10671071
/// Handle an incoming closing_signed message from the given peer.
10681072
fn handle_closing_signed(&self, their_node_id: &PublicKey, msg: &ClosingSigned);
10691073

1074+
// Interactive channel construction
1075+
/// Handle an incoming tx_add_input message from the given peer.
1076+
fn handle_tx_add_input(&self, their_node_id: &PublicKey, msg: &TxAddInput);
1077+
/// Handle an incoming tx_add_output message from the given peer.
1078+
fn handle_tx_add_output(&self, their_node_id: &PublicKey, msg: &TxAddOutput);
1079+
/// Handle an incoming tx_remove_input message from the given peer.
1080+
fn handle_tx_remove_input(&self, their_node_id: &PublicKey, msg: &TxRemoveInput);
1081+
/// Handle an incoming tx_remove_output message from the given peer.
1082+
fn handle_tx_remove_output(&self, their_node_id: &PublicKey, msg: &TxRemoveOutput);
1083+
/// Handle an incoming tx_complete message from the given peer.
1084+
fn handle_tx_complete(&self, their_node_id: &PublicKey, msg: &TxComplete);
1085+
/// Handle an incoming tx_signatures message from the given peer.
1086+
fn handle_tx_signatures(&self, their_node_id: &PublicKey, msg: &TxSignatures);
1087+
/// Handle an incoming tx_init_rbf message from the given peer.
1088+
fn handle_tx_init_rbf(&self, their_node_id: &PublicKey, msg: &TxInitRbf);
1089+
/// Handle an incoming tx_ack_rbf message from the given peer.
1090+
fn handle_tx_ack_rbf(&self, their_node_id: &PublicKey, msg: &TxAckRbf);
1091+
/// Handle an incoming tx_abort message from the given peer.
1092+
fn handle_tx_abort(&self, their_node_id: &PublicKey, msg: &TxAbort);
1093+
10701094
// HTLC handling:
10711095
/// Handle an incoming update_add_htlc message from the given peer.
10721096
fn handle_update_add_htlc(&self, their_node_id: &PublicKey, msg: &UpdateAddHTLC);

0 commit comments

Comments
 (0)