Skip to content

Commit c9c16b5

Browse files
committed
f - don't check splice feature bit
1 parent 1657987 commit c9c16b5

File tree

2 files changed

+12
-26
lines changed

2 files changed

+12
-26
lines changed

lightning/src/ln/channel.rs

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,12 +1664,12 @@ where
16641664
/// send our peer to begin the channel reconnection process.
16651665
#[rustfmt::skip]
16661666
pub fn peer_connected_get_handshake<L: Deref>(
1667-
&mut self, chain_hash: ChainHash, their_features: &InitFeatures, logger: &L,
1667+
&mut self, chain_hash: ChainHash, logger: &L,
16681668
) -> ReconnectionMsg where L::Target: Logger {
16691669
match &mut self.phase {
16701670
ChannelPhase::Undefined => unreachable!(),
16711671
ChannelPhase::Funded(chan) =>
1672-
ReconnectionMsg::Reestablish(chan.get_channel_reestablish(their_features, logger)),
1672+
ReconnectionMsg::Reestablish(chan.get_channel_reestablish(logger)),
16731673
ChannelPhase::UnfundedOutboundV1(chan) => {
16741674
chan.get_open_channel(chain_hash, logger)
16751675
.map(|msg| ReconnectionMsg::Open(OpenChannelMessage::V1(msg)))
@@ -10549,11 +10549,7 @@ where
1054910549
}
1055010550

1055110551
#[cfg(splicing)]
10552-
fn maybe_get_your_last_funding_locked_txid(&self, features: &InitFeatures) -> Option<Txid> {
10553-
if !features.supports_splicing() {
10554-
return None;
10555-
}
10556-
10552+
fn maybe_get_your_last_funding_locked_txid(&self) -> Option<Txid> {
1055710553
self.pending_splice
1055810554
.as_ref()
1055910555
.and_then(|pending_splice| pending_splice.received_funding_txid)
@@ -10562,16 +10558,12 @@ where
1056210558
})
1056310559
}
1056410560
#[cfg(not(splicing))]
10565-
fn maybe_get_your_last_funding_locked_txid(&self, _features: &InitFeatures) -> Option<Txid> {
10561+
fn maybe_get_your_last_funding_locked_txid(&self) -> Option<Txid> {
1056610562
None
1056710563
}
1056810564

1056910565
#[cfg(splicing)]
10570-
fn maybe_get_my_current_funding_locked_txid(&self, features: &InitFeatures) -> Option<Txid> {
10571-
if !features.supports_splicing() {
10572-
return None;
10573-
}
10574-
10566+
fn maybe_get_my_current_funding_locked_txid(&self) -> Option<Txid> {
1057510567
self.pending_splice
1057610568
.as_ref()
1057710569
.and_then(|pending_splice| pending_splice.sent_funding_txid)
@@ -10581,19 +10573,14 @@ where
1058110573
}
1058210574

1058310575
#[cfg(not(splicing))]
10584-
fn maybe_get_my_current_funding_locked_txid(&self, _features: &InitFeatures) -> Option<Txid> {
10576+
fn maybe_get_my_current_funding_locked_txid(&self) -> Option<Txid> {
1058510577
None
1058610578
}
1058710579

1058810580
/// May panic if called on a channel that wasn't immediately-previously
1058910581
/// self.remove_uncommitted_htlcs_and_mark_paused()'d
1059010582
#[rustfmt::skip]
10591-
fn get_channel_reestablish<L: Deref>(
10592-
&mut self, their_features: &InitFeatures, logger: &L,
10593-
) -> msgs::ChannelReestablish
10594-
where
10595-
L::Target: Logger,
10596-
{
10583+
fn get_channel_reestablish<L: Deref>(&mut self, logger: &L) -> msgs::ChannelReestablish where L::Target: Logger {
1059710584
assert!(self.context.channel_state.is_peer_disconnected());
1059810585
assert_ne!(self.context.cur_counterparty_commitment_transaction_number, INITIAL_COMMITMENT_NUMBER);
1059910586
// This is generally the first function which gets called on any given channel once we're
@@ -10641,8 +10628,8 @@ where
1064110628
your_last_per_commitment_secret: remote_last_secret,
1064210629
my_current_per_commitment_point: dummy_pubkey,
1064310630
next_funding_txid: self.maybe_get_next_funding_txid(),
10644-
your_last_funding_locked_txid: self.maybe_get_your_last_funding_locked_txid(their_features),
10645-
my_current_funding_locked_txid: self.maybe_get_my_current_funding_locked_txid(their_features),
10631+
your_last_funding_locked_txid: self.maybe_get_your_last_funding_locked_txid(),
10632+
my_current_funding_locked_txid: self.maybe_get_my_current_funding_locked_txid(),
1064610633
}
1064710634
}
1064810635

@@ -14509,15 +14496,15 @@ mod tests {
1450914496
// Now disconnect the two nodes and check that the commitment point in
1451014497
// Node B's channel_reestablish message is sane.
1451114498
assert!(node_b_chan.remove_uncommitted_htlcs_and_mark_paused(&&logger).is_ok());
14512-
let msg = node_b_chan.get_channel_reestablish(&channelmanager::provided_init_features(&config), &&logger);
14499+
let msg = node_b_chan.get_channel_reestablish(&&logger);
1451314500
assert_eq!(msg.next_local_commitment_number, 1); // now called next_commitment_number
1451414501
assert_eq!(msg.next_remote_commitment_number, 0); // now called next_revocation_number
1451514502
assert_eq!(msg.your_last_per_commitment_secret, [0; 32]);
1451614503

1451714504
// Check that the commitment point in Node A's channel_reestablish message
1451814505
// is sane.
1451914506
assert!(node_a_chan.remove_uncommitted_htlcs_and_mark_paused(&&logger).is_ok());
14520-
let msg = node_a_chan.get_channel_reestablish(&channelmanager::provided_init_features(&config), &&logger);
14507+
let msg = node_a_chan.get_channel_reestablish(&&logger);
1452114508
assert_eq!(msg.next_local_commitment_number, 1); // now called next_commitment_number
1452214509
assert_eq!(msg.next_remote_commitment_number, 0); // now called next_revocation_number
1452314510
assert_eq!(msg.your_last_per_commitment_secret, [0; 32]);

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13062,9 +13062,8 @@ where
1306213062
}
1306313063

1306413064
for (_, chan) in peer_state.channel_by_id.iter_mut() {
13065-
let features = &peer_state.latest_features;
1306613065
let logger = WithChannelContext::from(&self.logger, &chan.context(), None);
13067-
match chan.peer_connected_get_handshake(self.chain_hash, features, &&logger) {
13066+
match chan.peer_connected_get_handshake(self.chain_hash, &&logger) {
1306813067
ReconnectionMsg::Reestablish(msg) =>
1306913068
pending_msg_events.push(MessageSendEvent::SendChannelReestablish {
1307013069
node_id: chan.context().get_counterparty_node_id(),

0 commit comments

Comments
 (0)