Skip to content

Commit 0f2a888

Browse files
committed
f don't feature gate public api methods that were already shipped
1 parent 9c92004 commit 0f2a888

File tree

5 files changed

+104
-149
lines changed

5 files changed

+104
-149
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 104 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -9859,23 +9859,31 @@ where
98599859
});
98609860
}
98619861

9862-
#[cfg(any(dual_funding, splicing))]
98639862
fn handle_open_channel_v2(&self, counterparty_node_id: &PublicKey, msg: &msgs::OpenChannelV2) {
9864-
// Note that we never need to persist the updated ChannelManager for an inbound
9865-
// open_channel message - pre-funded channels are never written so there should be no
9866-
// change to the contents.
9867-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
9868-
let res = self.internal_open_channel(counterparty_node_id, OpenChannelMessage::V2(msg.clone()));
9869-
let persist = match &res {
9870-
Err(e) if e.closes_channel() => {
9871-
debug_assert!(false, "We shouldn't close a new channel");
9872-
NotifyOption::DoPersist
9873-
},
9874-
_ => NotifyOption::SkipPersistHandleEvents,
9875-
};
9876-
let _ = handle_error!(self, res, *counterparty_node_id);
9877-
persist
9878-
});
9863+
#[cfg(any(dual_funding, splicing))]
9864+
{
9865+
// Note that we never need to persist the updated ChannelManager for an inbound
9866+
// open_channel message - pre-funded channels are never written so there should be no
9867+
// change to the contents.
9868+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
9869+
let res = self.internal_open_channel(counterparty_node_id, OpenChannelMessage::V2(msg.clone()));
9870+
let persist = match &res {
9871+
Err(e) if e.closes_channel() => {
9872+
debug_assert!(false, "We shouldn't close a new channel");
9873+
NotifyOption::DoPersist
9874+
},
9875+
_ => NotifyOption::SkipPersistHandleEvents,
9876+
};
9877+
let _ = handle_error!(self, res, *counterparty_node_id);
9878+
persist
9879+
});
9880+
};
9881+
#[cfg(not(any(dual_funding, splicing)))]
9882+
{
9883+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
9884+
"Dual-funded channels not supported".to_owned(),
9885+
msg.common_fields.temporary_channel_id.clone())), *counterparty_node_id);
9886+
};
98799887
}
98809888

98819889
fn handle_accept_channel(&self, counterparty_node_id: &PublicKey, msg: &msgs::AcceptChannel) {
@@ -9888,7 +9896,6 @@ where
98889896
});
98899897
}
98909898

9891-
#[cfg(any(dual_funding, splicing))]
98929899
fn handle_accept_channel_v2(&self, counterparty_node_id: &PublicKey, msg: &msgs::AcceptChannelV2) {
98939900
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
98949901
"Dual-funded channels not supported".to_owned(),
@@ -10420,83 +10427,119 @@ where
1042010427
Some(vec![self.chain_hash])
1042110428
}
1042210429

10423-
#[cfg(any(dual_funding, splicing))]
1042410430
fn handle_tx_add_input(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxAddInput) {
10425-
// Note that we never need to persist the updated ChannelManager for an inbound
10426-
// tx_add_input message - interactive transaction construction does not need to
10427-
// be persisted before any signatures are exchanged.
10428-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10429-
let _ = handle_error!(self, self.internal_tx_add_input(counterparty_node_id, msg), *counterparty_node_id);
10430-
NotifyOption::SkipPersistHandleEvents
10431-
});
10431+
#[cfg(any(dual_funding, splicing))]
10432+
{
10433+
// Note that we never need to persist the updated ChannelManager for an inbound
10434+
// tx_add_input message - interactive transaction construction does not need to
10435+
// be persisted before any signatures are exchanged.
10436+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10437+
let _ = handle_error!(self, self.internal_tx_add_input(counterparty_node_id, msg), *counterparty_node_id);
10438+
NotifyOption::SkipPersistHandleEvents
10439+
});
10440+
};
10441+
#[cfg(not(any(dual_funding, splicing)))]
10442+
{
10443+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10444+
"Dual-funded channels not supported".to_owned(),
10445+
msg.channel_id.clone())), *counterparty_node_id);
10446+
};
1043210447
}
1043310448

10434-
#[cfg(any(dual_funding, splicing))]
1043510449
fn handle_tx_add_output(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxAddOutput) {
10436-
// Note that we never need to persist the updated ChannelManager for an inbound
10437-
// tx_add_input message - interactive transaction construction does not need to
10438-
// be persisted before any signatures are exchanged.
10439-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10440-
let _ = handle_error!(self, self.internal_tx_add_output(counterparty_node_id, msg), *counterparty_node_id);
10441-
NotifyOption::SkipPersistHandleEvents
10442-
});
10450+
#[cfg(any(dual_funding, splicing))]
10451+
{
10452+
// Note that we never need to persist the updated ChannelManager for an inbound
10453+
// tx_add_input message - interactive transaction construction does not need to
10454+
// be persisted before any signatures are exchanged.
10455+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10456+
let _ = handle_error!(self, self.internal_tx_add_output(counterparty_node_id, msg), *counterparty_node_id);
10457+
NotifyOption::SkipPersistHandleEvents
10458+
});
10459+
};
10460+
#[cfg(not(any(dual_funding, splicing)))]
10461+
{
10462+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10463+
"Dual-funded channels not supported".to_owned(),
10464+
msg.channel_id.clone())), *counterparty_node_id);
10465+
};
1044310466
}
1044410467

10445-
#[cfg(any(dual_funding, splicing))]
1044610468
fn handle_tx_remove_input(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxRemoveInput) {
10447-
// Note that we never need to persist the updated ChannelManager for an inbound
10448-
// tx_add_input message - interactive transaction construction does not need to
10449-
// be persisted before any signatures are exchanged.
10450-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10451-
let _ = handle_error!(self, self.internal_tx_remove_input(counterparty_node_id, msg), *counterparty_node_id);
10452-
NotifyOption::SkipPersistHandleEvents
10453-
});
10469+
#[cfg(any(dual_funding, splicing))]
10470+
{
10471+
// Note that we never need to persist the updated ChannelManager for an inbound
10472+
// tx_add_input message - interactive transaction construction does not need to
10473+
// be persisted before any signatures are exchanged.
10474+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10475+
let _ = handle_error!(self, self.internal_tx_remove_input(counterparty_node_id, msg), *counterparty_node_id);
10476+
NotifyOption::SkipPersistHandleEvents
10477+
});
10478+
};
10479+
#[cfg(not(any(dual_funding, splicing)))]
10480+
{
10481+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10482+
"Dual-funded channels not supported".to_owned(),
10483+
msg.channel_id.clone())), *counterparty_node_id);
10484+
};
1045410485
}
1045510486

10456-
#[cfg(any(dual_funding, splicing))]
1045710487
fn handle_tx_remove_output(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxRemoveOutput) {
10458-
// Note that we never need to persist the updated ChannelManager for an inbound
10459-
// tx_add_input message - interactive transaction construction does not need to
10460-
// be persisted before any signatures are exchanged.
10461-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10462-
let _ = handle_error!(self, self.internal_tx_remove_output(counterparty_node_id, msg), *counterparty_node_id);
10463-
NotifyOption::SkipPersistHandleEvents
10464-
});
10488+
#[cfg(any(dual_funding, splicing))]
10489+
{
10490+
// Note that we never need to persist the updated ChannelManager for an inbound
10491+
// tx_add_input message - interactive transaction construction does not need to
10492+
// be persisted before any signatures are exchanged.
10493+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10494+
let _ = handle_error!(self, self.internal_tx_remove_output(counterparty_node_id, msg), *counterparty_node_id);
10495+
NotifyOption::SkipPersistHandleEvents
10496+
});
10497+
};
10498+
#[cfg(not(any(dual_funding, splicing)))]
10499+
{
10500+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10501+
"Dual-funded channels not supported".to_owned(),
10502+
msg.channel_id.clone())), *counterparty_node_id);
10503+
};
1046510504
}
1046610505

10467-
#[cfg(any(dual_funding, splicing))]
1046810506
fn handle_tx_complete(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxComplete) {
10469-
// Note that we never need to persist the updated ChannelManager for an inbound
10470-
// tx_add_input message - interactive transaction construction does not need to
10471-
// be persisted before any signatures are exchanged.
10472-
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10473-
let _ = handle_error!(self, self.internal_tx_complete(counterparty_node_id, msg), *counterparty_node_id);
10474-
NotifyOption::SkipPersistHandleEvents
10475-
});
10507+
#[cfg(any(dual_funding, splicing))]
10508+
{
10509+
// Note that we never need to persist the updated ChannelManager for an inbound
10510+
// tx_add_input message - interactive transaction construction does not need to
10511+
// be persisted before any signatures are exchanged.
10512+
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
10513+
let _ = handle_error!(self, self.internal_tx_complete(counterparty_node_id, msg), *counterparty_node_id);
10514+
NotifyOption::SkipPersistHandleEvents
10515+
});
10516+
};
10517+
#[cfg(not(any(dual_funding, splicing)))]
10518+
{
10519+
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
10520+
"Dual-funded channels not supported".to_owned(),
10521+
msg.channel_id.clone())), *counterparty_node_id);
10522+
};
1047610523
}
1047710524

10478-
#[cfg(any(dual_funding, splicing))]
1047910525
fn handle_tx_signatures(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxSignatures) {
1048010526
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
1048110527
"Dual-funded channels not supported".to_owned(),
1048210528
msg.channel_id.clone())), *counterparty_node_id);
1048310529
}
1048410530

10485-
#[cfg(any(dual_funding, splicing))]
1048610531
fn handle_tx_init_rbf(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxInitRbf) {
1048710532
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
1048810533
"Dual-funded channels not supported".to_owned(),
1048910534
msg.channel_id.clone())), *counterparty_node_id);
1049010535
}
1049110536

10492-
#[cfg(any(dual_funding, splicing))]
1049310537
fn handle_tx_ack_rbf(&self, counterparty_node_id: &PublicKey, msg: &msgs::TxAckRbf) {
1049410538
let _: Result<(), _> = handle_error!(self, Err(MsgHandleErrInternal::send_err_msg_no_close(
1049510539
"Dual-funded channels not supported".to_owned(),
1049610540
msg.channel_id.clone())), *counterparty_node_id);
1049710541
}
1049810542

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

lightning/src/ln/peer_handler.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -322,57 +322,46 @@ impl ChannelMessageHandler for ErroringMessageHandler {
322322
None
323323
}
324324

325-
#[cfg(any(dual_funding, splicing))]
326325
fn handle_open_channel_v2(&self, their_node_id: &PublicKey, msg: &msgs::OpenChannelV2) {
327326
ErroringMessageHandler::push_error(self, their_node_id, msg.common_fields.temporary_channel_id);
328327
}
329328

330-
#[cfg(any(dual_funding, splicing))]
331329
fn handle_accept_channel_v2(&self, their_node_id: &PublicKey, msg: &msgs::AcceptChannelV2) {
332330
ErroringMessageHandler::push_error(self, their_node_id, msg.common_fields.temporary_channel_id);
333331
}
334332

335-
#[cfg(any(dual_funding, splicing))]
336333
fn handle_tx_add_input(&self, their_node_id: &PublicKey, msg: &msgs::TxAddInput) {
337334
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
338335
}
339336

340-
#[cfg(any(dual_funding, splicing))]
341337
fn handle_tx_add_output(&self, their_node_id: &PublicKey, msg: &msgs::TxAddOutput) {
342338
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
343339
}
344340

345-
#[cfg(any(dual_funding, splicing))]
346341
fn handle_tx_remove_input(&self, their_node_id: &PublicKey, msg: &msgs::TxRemoveInput) {
347342
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
348343
}
349344

350-
#[cfg(any(dual_funding, splicing))]
351345
fn handle_tx_remove_output(&self, their_node_id: &PublicKey, msg: &msgs::TxRemoveOutput) {
352346
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
353347
}
354348

355-
#[cfg(any(dual_funding, splicing))]
356349
fn handle_tx_complete(&self, their_node_id: &PublicKey, msg: &msgs::TxComplete) {
357350
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
358351
}
359352

360-
#[cfg(any(dual_funding, splicing))]
361353
fn handle_tx_signatures(&self, their_node_id: &PublicKey, msg: &msgs::TxSignatures) {
362354
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
363355
}
364356

365-
#[cfg(any(dual_funding, splicing))]
366357
fn handle_tx_init_rbf(&self, their_node_id: &PublicKey, msg: &msgs::TxInitRbf) {
367358
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
368359
}
369360

370-
#[cfg(any(dual_funding, splicing))]
371361
fn handle_tx_ack_rbf(&self, their_node_id: &PublicKey, msg: &msgs::TxAckRbf) {
372362
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
373363
}
374364

375-
#[cfg(any(dual_funding, splicing))]
376365
fn handle_tx_abort(&self, their_node_id: &PublicKey, msg: &msgs::TxAbort) {
377366
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
378367
}
@@ -1772,14 +1761,12 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
17721761
wire::Message::OpenChannel(msg) => {
17731762
self.message_handler.chan_handler.handle_open_channel(&their_node_id, &msg);
17741763
},
1775-
#[cfg(any(dual_funding, splicing))]
17761764
wire::Message::OpenChannelV2(msg) => {
17771765
self.message_handler.chan_handler.handle_open_channel_v2(&their_node_id, &msg);
17781766
},
17791767
wire::Message::AcceptChannel(msg) => {
17801768
self.message_handler.chan_handler.handle_accept_channel(&their_node_id, &msg);
17811769
},
1782-
#[cfg(any(dual_funding, splicing))]
17831770
wire::Message::AcceptChannelV2(msg) => {
17841771
self.message_handler.chan_handler.handle_accept_channel_v2(&their_node_id, &msg);
17851772
},
@@ -1814,39 +1801,30 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
18141801
}
18151802

18161803
// Interactive transaction construction messages:
1817-
#[cfg(any(dual_funding, splicing))]
18181804
wire::Message::TxAddInput(msg) => {
18191805
self.message_handler.chan_handler.handle_tx_add_input(&their_node_id, &msg);
18201806
},
1821-
#[cfg(any(dual_funding, splicing))]
18221807
wire::Message::TxAddOutput(msg) => {
18231808
self.message_handler.chan_handler.handle_tx_add_output(&their_node_id, &msg);
18241809
},
1825-
#[cfg(any(dual_funding, splicing))]
18261810
wire::Message::TxRemoveInput(msg) => {
18271811
self.message_handler.chan_handler.handle_tx_remove_input(&their_node_id, &msg);
18281812
},
1829-
#[cfg(any(dual_funding, splicing))]
18301813
wire::Message::TxRemoveOutput(msg) => {
18311814
self.message_handler.chan_handler.handle_tx_remove_output(&their_node_id, &msg);
18321815
},
1833-
#[cfg(any(dual_funding, splicing))]
18341816
wire::Message::TxComplete(msg) => {
18351817
self.message_handler.chan_handler.handle_tx_complete(&their_node_id, &msg);
18361818
},
1837-
#[cfg(any(dual_funding, splicing))]
18381819
wire::Message::TxSignatures(msg) => {
18391820
self.message_handler.chan_handler.handle_tx_signatures(&their_node_id, &msg);
18401821
},
1841-
#[cfg(any(dual_funding, splicing))]
18421822
wire::Message::TxInitRbf(msg) => {
18431823
self.message_handler.chan_handler.handle_tx_init_rbf(&their_node_id, &msg);
18441824
},
1845-
#[cfg(any(dual_funding, splicing))]
18461825
wire::Message::TxAckRbf(msg) => {
18471826
self.message_handler.chan_handler.handle_tx_ack_rbf(&their_node_id, &msg);
18481827
},
1849-
#[cfg(any(dual_funding, splicing))]
18501828
wire::Message::TxAbort(msg) => {
18511829
self.message_handler.chan_handler.handle_tx_abort(&their_node_id, &msg);
18521830
}

0 commit comments

Comments
 (0)