Skip to content

Commit 24f541d

Browse files
committed
f don't feature gate public api methods that were already shipped
1 parent 4e7985c commit 24f541d

File tree

6 files changed

+104
-160
lines changed

6 files changed

+104
-160
lines changed

lightning-net-tokio/src/lib.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -621,9 +621,7 @@ mod tests {
621621
fn handle_update_fee(&self, _their_node_id: &PublicKey, _msg: &UpdateFee) {}
622622
fn handle_announcement_signatures(&self, _their_node_id: &PublicKey, _msg: &AnnouncementSignatures) {}
623623
fn handle_channel_update(&self, _their_node_id: &PublicKey, _msg: &ChannelUpdate) {}
624-
#[cfg(any(dual_funding, splicing))]
625624
fn handle_open_channel_v2(&self, _their_node_id: &PublicKey, _msg: &OpenChannelV2) {}
626-
#[cfg(any(dual_funding, splicing))]
627625
fn handle_accept_channel_v2(&self, _their_node_id: &PublicKey, _msg: &AcceptChannelV2) {}
628626
fn handle_stfu(&self, _their_node_id: &PublicKey, _msg: &Stfu) {}
629627
#[cfg(splicing)]
@@ -632,23 +630,14 @@ mod tests {
632630
fn handle_splice_ack(&self, _their_node_id: &PublicKey, _msg: &SpliceAck) {}
633631
#[cfg(splicing)]
634632
fn handle_splice_locked(&self, _their_node_id: &PublicKey, _msg: &SpliceLocked) {}
635-
#[cfg(any(dual_funding, splicing))]
636633
fn handle_tx_add_input(&self, _their_node_id: &PublicKey, _msg: &TxAddInput) {}
637-
#[cfg(any(dual_funding, splicing))]
638634
fn handle_tx_add_output(&self, _their_node_id: &PublicKey, _msg: &TxAddOutput) {}
639-
#[cfg(any(dual_funding, splicing))]
640635
fn handle_tx_remove_input(&self, _their_node_id: &PublicKey, _msg: &TxRemoveInput) {}
641-
#[cfg(any(dual_funding, splicing))]
642636
fn handle_tx_remove_output(&self, _their_node_id: &PublicKey, _msg: &TxRemoveOutput) {}
643-
#[cfg(any(dual_funding, splicing))]
644637
fn handle_tx_complete(&self, _their_node_id: &PublicKey, _msg: &TxComplete) {}
645-
#[cfg(any(dual_funding, splicing))]
646638
fn handle_tx_signatures(&self, _their_node_id: &PublicKey, _msg: &TxSignatures) {}
647-
#[cfg(any(dual_funding, splicing))]
648639
fn handle_tx_init_rbf(&self, _their_node_id: &PublicKey, _msg: &TxInitRbf) {}
649-
#[cfg(any(dual_funding, splicing))]
650640
fn handle_tx_ack_rbf(&self, _their_node_id: &PublicKey, _msg: &TxAckRbf) {}
651-
#[cfg(any(dual_funding, splicing))]
652641
fn handle_tx_abort(&self, _their_node_id: &PublicKey, _msg: &TxAbort) {}
653642
fn peer_disconnected(&self, their_node_id: &PublicKey) {
654643
if *their_node_id == self.expected_pubkey {

lightning/src/ln/channelmanager.rs

Lines changed: 104 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -10022,23 +10022,31 @@ where
1002210022
});
1002310023
}
1002410024

10025-
#[cfg(any(dual_funding, splicing))]
1002610025
fn handle_open_channel_v2(&self, counterparty_node_id: &PublicKey, msg: &msgs::OpenChannelV2) {
10027-
// Note that we never need to persist the updated ChannelManager for an inbound
10028-
// open_channel message - pre-funded channels are never written so there should be no
10029-
// change to the contents.
10030-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10031-
let res = self.internal_open_channel(counterparty_node_id, OpenChannelMessage::V2(msg.clone()));
10032-
let persist = match &res {
10033-
Err(e) if e.closes_channel() => {
10034-
debug_assert!(false, "We shouldn't close a new channel");
10035-
NotifyOption::DoPersist
10036-
},
10037-
_ => NotifyOption::SkipPersistHandleEvents,
10038-
};
10039-
let _ = handle_error!(self, res, *counterparty_node_id);
10040-
persist
10041-
});
10026+
#[cfg(any(dual_funding, splicing))]
10027+
{
10028+
// Note that we never need to persist the updated ChannelManager for an inbound
10029+
// open_channel message - pre-funded channels are never written so there should be no
10030+
// change to the contents.
10031+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10032+
let res = self.internal_open_channel(counterparty_node_id, OpenChannelMessage::V2(msg.clone()));
10033+
let persist = match &res {
10034+
Err(e) if e.closes_channel() => {
10035+
debug_assert!(false, "We shouldn't close a new channel");
10036+
NotifyOption::DoPersist
10037+
},
10038+
_ => NotifyOption::SkipPersistHandleEvents,
10039+
};
10040+
let _ = handle_error!(self, res, *counterparty_node_id);
10041+
persist
10042+
});
10043+
};
10044+
#[cfg(not(any(dual_funding, splicing)))]
10045+
{
10046+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10047+
"Dual-funded channels not supported".to_owned(),
10048+
msg.common_fields.temporary_channel_id.clone())), *counterparty_node_id);
10049+
};
1004210050
}
1004310051

1004410052
fn handle_accept_channel(&self, counterparty_node_id: &PublicKey, msg: &msgs::AcceptChannel) {
@@ -10051,7 +10059,6 @@ where
1005110059
});
1005210060
}
1005310061

10054-
#[cfg(any(dual_funding, splicing))]
1005510062
fn handle_accept_channel_v2(&self, counterparty_node_id: &PublicKey, msg: &msgs::AcceptChannelV2) {
1005610063
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
1005710064
"Dual-funded channels not supported".to_owned(),
@@ -10583,83 +10590,119 @@ where
1058310590
Some(vec![self.chain_hash])
1058410591
}
1058510592

10586-
#[cfg(any(dual_funding, splicing))]
1058710593
fn handle_tx_add_input(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxAddInput) {
10588-
// Note that we never need to persist the updated ChannelManager for an inbound
10589-
// tx_add_input message - interactive transaction construction does not need to
10590-
// be persisted before any signatures are exchanged.
10591-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10592-
let _ = handle_error!(self, self.internal_tx_add_input(counterparty_node_id, msg), *counterparty_node_id);
10593-
NotifyOption::SkipPersistHandleEvents
10594-
});
10594+
#[cfg(any(dual_funding, splicing))]
10595+
{
10596+
// Note that we never need to persist the updated ChannelManager for an inbound
10597+
// tx_add_input message - interactive transaction construction does not need to
10598+
// be persisted before any signatures are exchanged.
10599+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10600+
let _ = handle_error!(self, self.internal_tx_add_input(counterparty_node_id, msg), *counterparty_node_id);
10601+
NotifyOption::SkipPersistHandleEvents
10602+
});
10603+
};
10604+
#[cfg(not(any(dual_funding, splicing)))]
10605+
{
10606+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10607+
"Dual-funded channels not supported".to_owned(),
10608+
msg.channel_id.clone())), *counterparty_node_id);
10609+
};
1059510610
}
1059610611

10597-
#[cfg(any(dual_funding, splicing))]
1059810612
fn handle_tx_add_output(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxAddOutput) {
10599-
// Note that we never need to persist the updated ChannelManager for an inbound
10600-
// tx_add_input message - interactive transaction construction does not need to
10601-
// be persisted before any signatures are exchanged.
10602-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10603-
let _ = handle_error!(self, self.internal_tx_add_output(counterparty_node_id, msg), *counterparty_node_id);
10604-
NotifyOption::SkipPersistHandleEvents
10605-
});
10613+
#[cfg(any(dual_funding, splicing))]
10614+
{
10615+
// Note that we never need to persist the updated ChannelManager for an inbound
10616+
// tx_add_input message - interactive transaction construction does not need to
10617+
// be persisted before any signatures are exchanged.
10618+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10619+
let _ = handle_error!(self, self.internal_tx_add_output(counterparty_node_id, msg), *counterparty_node_id);
10620+
NotifyOption::SkipPersistHandleEvents
10621+
});
10622+
};
10623+
#[cfg(not(any(dual_funding, splicing)))]
10624+
{
10625+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10626+
"Dual-funded channels not supported".to_owned(),
10627+
msg.channel_id.clone())), *counterparty_node_id);
10628+
};
1060610629
}
1060710630

10608-
#[cfg(any(dual_funding, splicing))]
1060910631
fn handle_tx_remove_input(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxRemoveInput) {
10610-
// Note that we never need to persist the updated ChannelManager for an inbound
10611-
// tx_add_input message - interactive transaction construction does not need to
10612-
// be persisted before any signatures are exchanged.
10613-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10614-
let _ = handle_error!(self, self.internal_tx_remove_input(counterparty_node_id, msg), *counterparty_node_id);
10615-
NotifyOption::SkipPersistHandleEvents
10616-
});
10632+
#[cfg(any(dual_funding, splicing))]
10633+
{
10634+
// Note that we never need to persist the updated ChannelManager for an inbound
10635+
// tx_add_input message - interactive transaction construction does not need to
10636+
// be persisted before any signatures are exchanged.
10637+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10638+
let _ = handle_error!(self, self.internal_tx_remove_input(counterparty_node_id, msg), *counterparty_node_id);
10639+
NotifyOption::SkipPersistHandleEvents
10640+
});
10641+
};
10642+
#[cfg(not(any(dual_funding, splicing)))]
10643+
{
10644+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10645+
"Dual-funded channels not supported".to_owned(),
10646+
msg.channel_id.clone())), *counterparty_node_id);
10647+
};
1061710648
}
1061810649

10619-
#[cfg(any(dual_funding, splicing))]
1062010650
fn handle_tx_remove_output(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxRemoveOutput) {
10621-
// Note that we never need to persist the updated ChannelManager for an inbound
10622-
// tx_add_input message - interactive transaction construction does not need to
10623-
// be persisted before any signatures are exchanged.
10624-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10625-
let _ = handle_error!(self, self.internal_tx_remove_output(counterparty_node_id, msg), *counterparty_node_id);
10626-
NotifyOption::SkipPersistHandleEvents
10627-
});
10651+
#[cfg(any(dual_funding, splicing))]
10652+
{
10653+
// Note that we never need to persist the updated ChannelManager for an inbound
10654+
// tx_add_input message - interactive transaction construction does not need to
10655+
// be persisted before any signatures are exchanged.
10656+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10657+
let _ = handle_error!(self, self.internal_tx_remove_output(counterparty_node_id, msg), *counterparty_node_id);
10658+
NotifyOption::SkipPersistHandleEvents
10659+
});
10660+
};
10661+
#[cfg(not(any(dual_funding, splicing)))]
10662+
{
10663+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10664+
"Dual-funded channels not supported".to_owned(),
10665+
msg.channel_id.clone())), *counterparty_node_id);
10666+
};
1062810667
}
1062910668

10630-
#[cfg(any(dual_funding, splicing))]
1063110669
fn handle_tx_complete(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxComplete) {
10632-
// Note that we never need to persist the updated ChannelManager for an inbound
10633-
// tx_add_input message - interactive transaction construction does not need to
10634-
// be persisted before any signatures are exchanged.
10635-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10636-
let _ = handle_error!(self, self.internal_tx_complete(counterparty_node_id, msg), *counterparty_node_id);
10637-
NotifyOption::SkipPersistHandleEvents
10638-
});
10670+
#[cfg(any(dual_funding, splicing))]
10671+
{
10672+
// Note that we never need to persist the updated ChannelManager for an inbound
10673+
// tx_add_input message - interactive transaction construction does not need to
10674+
// be persisted before any signatures are exchanged.
10675+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10676+
let _ = handle_error!(self, self.internal_tx_complete(counterparty_node_id, msg), *counterparty_node_id);
10677+
NotifyOption::SkipPersistHandleEvents
10678+
});
10679+
};
10680+
#[cfg(not(any(dual_funding, splicing)))]
10681+
{
10682+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10683+
"Dual-funded channels not supported".to_owned(),
10684+
msg.channel_id.clone())), *counterparty_node_id);
10685+
};
1063910686
}
1064010687

10641-
#[cfg(any(dual_funding, splicing))]
1064210688
fn handle_tx_signatures(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxSignatures) {
1064310689
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
1064410690
"Dual-funded channels not supported".to_owned(),
1064510691
msg.channel_id.clone())), *counterparty_node_id);
1064610692
}
1064710693

10648-
#[cfg(any(dual_funding, splicing))]
1064910694
fn handle_tx_init_rbf(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxInitRbf) {
1065010695
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
1065110696
"Dual-funded channels not supported".to_owned(),
1065210697
msg.channel_id.clone())), *counterparty_node_id);
1065310698
}
1065410699

10655-
#[cfg(any(dual_funding, splicing))]
1065610700
fn handle_tx_ack_rbf(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxAckRbf) {
1065710701
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
1065810702
"Dual-funded channels not supported".to_owned(),
1065910703
msg.channel_id.clone())), *counterparty_node_id);
1066010704
}
1066110705

10662-
#[cfg(any(dual_funding, splicing))]
1066310706
fn handle_tx_abort(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxAbort) {
1066410707
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
1066510708
"Dual-funded channels not supported".to_owned(),

lightning/src/ln/msgs.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,12 +1438,10 @@ pub trait ChannelMessageHandler : MessageSendEventsProvider {
14381438
/// Handle an incoming `open_channel` message from the given peer.
14391439
fn handle_open_channel(&self, their_node_id: &PublicKey, msg: &OpenChannel);
14401440
/// Handle an incoming `open_channel2` message from the given peer.
1441-
#[cfg(any(dual_funding, splicing))]
14421441
fn handle_open_channel_v2(&self, their_node_id: &PublicKey, msg: &OpenChannelV2);
14431442
/// Handle an incoming `accept_channel` message from the given peer.
14441443
fn handle_accept_channel(&self, their_node_id: &PublicKey, msg: &AcceptChannel);
14451444
/// Handle an incoming `accept_channel2` message from the given peer.
1446-
#[cfg(any(dual_funding, splicing))]
14471445
fn handle_accept_channel_v2(&self, their_node_id: &PublicKey, msg: &AcceptChannelV2);
14481446
/// Handle an incoming `funding_created` message from the given peer.
14491447
fn handle_funding_created(&self, their_node_id: &PublicKey, msg: &FundingCreated);
@@ -1475,31 +1473,22 @@ pub trait ChannelMessageHandler : MessageSendEventsProvider {
14751473

14761474
// Interactive channel construction
14771475
/// Handle an incoming `tx_add_input message` from the given peer.
1478-
#[cfg(any(dual_funding, splicing))]
14791476
fn handle_tx_add_input(&self, their_node_id: &PublicKey, msg: &TxAddInput);
14801477
/// Handle an incoming `tx_add_output` message from the given peer.
1481-
#[cfg(any(dual_funding, splicing))]
14821478
fn handle_tx_add_output(&self, their_node_id: &PublicKey, msg: &TxAddOutput);
14831479
/// Handle an incoming `tx_remove_input` message from the given peer.
1484-
#[cfg(any(dual_funding, splicing))]
14851480
fn handle_tx_remove_input(&self, their_node_id: &PublicKey, msg: &TxRemoveInput);
14861481
/// Handle an incoming `tx_remove_output` message from the given peer.
1487-
#[cfg(any(dual_funding, splicing))]
14881482
fn handle_tx_remove_output(&self, their_node_id: &PublicKey, msg: &TxRemoveOutput);
14891483
/// Handle an incoming `tx_complete message` from the given peer.
1490-
#[cfg(any(dual_funding, splicing))]
14911484
fn handle_tx_complete(&self, their_node_id: &PublicKey, msg: &TxComplete);
14921485
/// Handle an incoming `tx_signatures` message from the given peer.
1493-
#[cfg(any(dual_funding, splicing))]
14941486
fn handle_tx_signatures(&self, their_node_id: &PublicKey, msg: &TxSignatures);
14951487
/// Handle an incoming `tx_init_rbf` message from the given peer.
1496-
#[cfg(any(dual_funding, splicing))]
14971488
fn handle_tx_init_rbf(&self, their_node_id: &PublicKey, msg: &TxInitRbf);
14981489
/// Handle an incoming `tx_ack_rbf` message from the given peer.
1499-
#[cfg(any(dual_funding, splicing))]
15001490
fn handle_tx_ack_rbf(&self, their_node_id: &PublicKey, msg: &TxAckRbf);
15011491
/// Handle an incoming `tx_abort message` from the given peer.
1502-
#[cfg(any(dual_funding, splicing))]
15031492
fn handle_tx_abort(&self, their_node_id: &PublicKey, msg: &TxAbort);
15041493

15051494
// HTLC handling:

0 commit comments

Comments
 (0)