Skip to content

Commit 41cc71a

Browse files
committed
f don't feature gate public api methods that were already shipped
1 parent 4262eef commit 41cc71a

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
@@ -9993,23 +9993,31 @@ where
99939993
});
99949994
}
99959995

9996-
#[cfg(any(dual_funding, splicing))]
99979996
fn handle_open_channel_v2(&self, counterparty_node_id: &PublicKey, msg: &msgs::OpenChannelV2) {
9998-
// Note that we never need to persist the updated ChannelManager for an inbound
9999-
// open_channel message - pre-funded channels are never written so there should be no
10000-
// change to the contents.
10001-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10002-
let res = self.internal_open_channel(counterparty_node_id, OpenChannelMessage::V2(msg.clone()));
10003-
let persist = match &res {
10004-
Err(e) if e.closes_channel() => {
10005-
debug_assert!(false, "We shouldn't close a new channel");
10006-
NotifyOption::DoPersist
10007-
},
10008-
_ => NotifyOption::SkipPersistHandleEvents,
10009-
};
10010-
let _ = handle_error!(self, res, *counterparty_node_id);
10011-
persist
10012-
});
9997+
#[cfg(any(dual_funding, splicing))]
9998+
{
9999+
// Note that we never need to persist the updated ChannelManager for an inbound
10000+
// open_channel message - pre-funded channels are never written so there should be no
10001+
// change to the contents.
10002+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10003+
let res = self.internal_open_channel(counterparty_node_id, OpenChannelMessage::V2(msg.clone()));
10004+
let persist = match &res {
10005+
Err(e) if e.closes_channel() => {
10006+
debug_assert!(false, "We shouldn't close a new channel");
10007+
NotifyOption::DoPersist
10008+
},
10009+
_ => NotifyOption::SkipPersistHandleEvents,
10010+
};
10011+
let _ = handle_error!(self, res, *counterparty_node_id);
10012+
persist
10013+
});
10014+
};
10015+
#[cfg(not(any(dual_funding, splicing)))]
10016+
{
10017+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10018+
"Dual-funded channels not supported".to_owned(),
10019+
msg.common_fields.temporary_channel_id.clone())), *counterparty_node_id);
10020+
};
1001310021
}
1001410022

1001510023
fn handle_accept_channel(&self, counterparty_node_id: &PublicKey, msg: &msgs::AcceptChannel) {
@@ -10022,7 +10030,6 @@ where
1002210030
});
1002310031
}
1002410032

10025-
#[cfg(any(dual_funding, splicing))]
1002610033
fn handle_accept_channel_v2(&self, counterparty_node_id: &PublicKey, msg: &msgs::AcceptChannelV2) {
1002710034
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
1002810035
"Dual-funded channels not supported".to_owned(),
@@ -10554,83 +10561,119 @@ where
1055410561
Some(vec![self.chain_hash])
1055510562
}
1055610563

10557-
#[cfg(any(dual_funding, splicing))]
1055810564
fn handle_tx_add_input(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxAddInput) {
10559-
// Note that we never need to persist the updated ChannelManager for an inbound
10560-
// tx_add_input message - interactive transaction construction does not need to
10561-
// be persisted before any signatures are exchanged.
10562-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10563-
let _ = handle_error!(self, self.internal_tx_add_input(counterparty_node_id, msg), *counterparty_node_id);
10564-
NotifyOption::SkipPersistHandleEvents
10565-
});
10565+
#[cfg(any(dual_funding, splicing))]
10566+
{
10567+
// Note that we never need to persist the updated ChannelManager for an inbound
10568+
// tx_add_input message - interactive transaction construction does not need to
10569+
// be persisted before any signatures are exchanged.
10570+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10571+
let _ = handle_error!(self, self.internal_tx_add_input(counterparty_node_id, msg), *counterparty_node_id);
10572+
NotifyOption::SkipPersistHandleEvents
10573+
});
10574+
};
10575+
#[cfg(not(any(dual_funding, splicing)))]
10576+
{
10577+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10578+
"Dual-funded channels not supported".to_owned(),
10579+
msg.channel_id.clone())), *counterparty_node_id);
10580+
};
1056610581
}
1056710582

10568-
#[cfg(any(dual_funding, splicing))]
1056910583
fn handle_tx_add_output(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxAddOutput) {
10570-
// Note that we never need to persist the updated ChannelManager for an inbound
10571-
// tx_add_input message - interactive transaction construction does not need to
10572-
// be persisted before any signatures are exchanged.
10573-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10574-
let _ = handle_error!(self, self.internal_tx_add_output(counterparty_node_id, msg), *counterparty_node_id);
10575-
NotifyOption::SkipPersistHandleEvents
10576-
});
10584+
#[cfg(any(dual_funding, splicing))]
10585+
{
10586+
// Note that we never need to persist the updated ChannelManager for an inbound
10587+
// tx_add_input message - interactive transaction construction does not need to
10588+
// be persisted before any signatures are exchanged.
10589+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10590+
let _ = handle_error!(self, self.internal_tx_add_output(counterparty_node_id, msg), *counterparty_node_id);
10591+
NotifyOption::SkipPersistHandleEvents
10592+
});
10593+
};
10594+
#[cfg(not(any(dual_funding, splicing)))]
10595+
{
10596+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10597+
"Dual-funded channels not supported".to_owned(),
10598+
msg.channel_id.clone())), *counterparty_node_id);
10599+
};
1057710600
}
1057810601

10579-
#[cfg(any(dual_funding, splicing))]
1058010602
fn handle_tx_remove_input(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxRemoveInput) {
10581-
// Note that we never need to persist the updated ChannelManager for an inbound
10582-
// tx_add_input message - interactive transaction construction does not need to
10583-
// be persisted before any signatures are exchanged.
10584-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10585-
let _ = handle_error!(self, self.internal_tx_remove_input(counterparty_node_id, msg), *counterparty_node_id);
10586-
NotifyOption::SkipPersistHandleEvents
10587-
});
10603+
#[cfg(any(dual_funding, splicing))]
10604+
{
10605+
// Note that we never need to persist the updated ChannelManager for an inbound
10606+
// tx_add_input message - interactive transaction construction does not need to
10607+
// be persisted before any signatures are exchanged.
10608+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10609+
let _ = handle_error!(self, self.internal_tx_remove_input(counterparty_node_id, msg), *counterparty_node_id);
10610+
NotifyOption::SkipPersistHandleEvents
10611+
});
10612+
};
10613+
#[cfg(not(any(dual_funding, splicing)))]
10614+
{
10615+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10616+
"Dual-funded channels not supported".to_owned(),
10617+
msg.channel_id.clone())), *counterparty_node_id);
10618+
};
1058810619
}
1058910620

10590-
#[cfg(any(dual_funding, splicing))]
1059110621
fn handle_tx_remove_output(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxRemoveOutput) {
10592-
// Note that we never need to persist the updated ChannelManager for an inbound
10593-
// tx_add_input message - interactive transaction construction does not need to
10594-
// be persisted before any signatures are exchanged.
10595-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10596-
let _ = handle_error!(self, self.internal_tx_remove_output(counterparty_node_id, msg), *counterparty_node_id);
10597-
NotifyOption::SkipPersistHandleEvents
10598-
});
10622+
#[cfg(any(dual_funding, splicing))]
10623+
{
10624+
// Note that we never need to persist the updated ChannelManager for an inbound
10625+
// tx_add_input message - interactive transaction construction does not need to
10626+
// be persisted before any signatures are exchanged.
10627+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10628+
let _ = handle_error!(self, self.internal_tx_remove_output(counterparty_node_id, msg), *counterparty_node_id);
10629+
NotifyOption::SkipPersistHandleEvents
10630+
});
10631+
};
10632+
#[cfg(not(any(dual_funding, splicing)))]
10633+
{
10634+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10635+
"Dual-funded channels not supported".to_owned(),
10636+
msg.channel_id.clone())), *counterparty_node_id);
10637+
};
1059910638
}
1060010639

10601-
#[cfg(any(dual_funding, splicing))]
1060210640
fn handle_tx_complete(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxComplete) {
10603-
// Note that we never need to persist the updated ChannelManager for an inbound
10604-
// tx_add_input message - interactive transaction construction does not need to
10605-
// be persisted before any signatures are exchanged.
10606-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10607-
let _ = handle_error!(self, self.internal_tx_complete(counterparty_node_id, msg), *counterparty_node_id);
10608-
NotifyOption::SkipPersistHandleEvents
10609-
});
10641+
#[cfg(any(dual_funding, splicing))]
10642+
{
10643+
// Note that we never need to persist the updated ChannelManager for an inbound
10644+
// tx_add_input message - interactive transaction construction does not need to
10645+
// be persisted before any signatures are exchanged.
10646+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10647+
let _ = handle_error!(self, self.internal_tx_complete(counterparty_node_id, msg), *counterparty_node_id);
10648+
NotifyOption::SkipPersistHandleEvents
10649+
});
10650+
};
10651+
#[cfg(not(any(dual_funding, splicing)))]
10652+
{
10653+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10654+
"Dual-funded channels not supported".to_owned(),
10655+
msg.channel_id.clone())), *counterparty_node_id);
10656+
};
1061010657
}
1061110658

10612-
#[cfg(any(dual_funding, splicing))]
1061310659
fn handle_tx_signatures(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxSignatures) {
1061410660
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
1061510661
"Dual-funded channels not supported".to_owned(),
1061610662
msg.channel_id.clone())), *counterparty_node_id);
1061710663
}
1061810664

10619-
#[cfg(any(dual_funding, splicing))]
1062010665
fn handle_tx_init_rbf(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxInitRbf) {
1062110666
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
1062210667
"Dual-funded channels not supported".to_owned(),
1062310668
msg.channel_id.clone())), *counterparty_node_id);
1062410669
}
1062510670

10626-
#[cfg(any(dual_funding, splicing))]
1062710671
fn handle_tx_ack_rbf(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxAckRbf) {
1062810672
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
1062910673
"Dual-funded channels not supported".to_owned(),
1063010674
msg.channel_id.clone())), *counterparty_node_id);
1063110675
}
1063210676

10633-
#[cfg(any(dual_funding, splicing))]
1063410677
fn handle_tx_abort(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxAbort) {
1063510678
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
1063610679
"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)