Skip to content

Commit af99c2d

Browse files
committed
f - don't check splice feature bit
1 parent 221fd75 commit af99c2d

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)))
@@ -10561,11 +10561,7 @@ where
1056110561
}
1056210562

1056310563
#[cfg(splicing)]
10564-
fn maybe_get_your_last_funding_locked_txid(&self, features: &InitFeatures) -> Option<Txid> {
10565-
if !features.supports_splicing() {
10566-
return None;
10567-
}
10568-
10564+
fn maybe_get_your_last_funding_locked_txid(&self) -> Option<Txid> {
1056910565
self.pending_splice
1057010566
.as_ref()
1057110567
.and_then(|pending_splice| pending_splice.received_funding_txid)
@@ -10574,16 +10570,12 @@ where
1057410570
})
1057510571
}
1057610572
#[cfg(not(splicing))]
10577-
fn maybe_get_your_last_funding_locked_txid(&self, _features: &InitFeatures) -> Option<Txid> {
10573+
fn maybe_get_your_last_funding_locked_txid(&self) -> Option<Txid> {
1057810574
None
1057910575
}
1058010576

1058110577
#[cfg(splicing)]
10582-
fn maybe_get_my_current_funding_locked_txid(&self, features: &InitFeatures) -> Option<Txid> {
10583-
if !features.supports_splicing() {
10584-
return None;
10585-
}
10586-
10578+
fn maybe_get_my_current_funding_locked_txid(&self) -> Option<Txid> {
1058710579
self.pending_splice
1058810580
.as_ref()
1058910581
.and_then(|pending_splice| pending_splice.sent_funding_txid)
@@ -10593,19 +10585,14 @@ where
1059310585
}
1059410586

1059510587
#[cfg(not(splicing))]
10596-
fn maybe_get_my_current_funding_locked_txid(&self, _features: &InitFeatures) -> Option<Txid> {
10588+
fn maybe_get_my_current_funding_locked_txid(&self) -> Option<Txid> {
1059710589
None
1059810590
}
1059910591

1060010592
/// May panic if called on a channel that wasn't immediately-previously
1060110593
/// self.remove_uncommitted_htlcs_and_mark_paused()'d
1060210594
#[rustfmt::skip]
10603-
fn get_channel_reestablish<L: Deref>(
10604-
&mut self, their_features: &InitFeatures, logger: &L,
10605-
) -> msgs::ChannelReestablish
10606-
where
10607-
L::Target: Logger,
10608-
{
10595+
fn get_channel_reestablish<L: Deref>(&mut self, logger: &L) -> msgs::ChannelReestablish where L::Target: Logger {
1060910596
assert!(self.context.channel_state.is_peer_disconnected());
1061010597
assert_ne!(self.context.cur_counterparty_commitment_transaction_number, INITIAL_COMMITMENT_NUMBER);
1061110598
// This is generally the first function which gets called on any given channel once we're
@@ -10653,8 +10640,8 @@ where
1065310640
your_last_per_commitment_secret: remote_last_secret,
1065410641
my_current_per_commitment_point: dummy_pubkey,
1065510642
next_funding_txid: self.maybe_get_next_funding_txid(),
10656-
your_last_funding_locked_txid: self.maybe_get_your_last_funding_locked_txid(their_features),
10657-
my_current_funding_locked_txid: self.maybe_get_my_current_funding_locked_txid(their_features),
10643+
your_last_funding_locked_txid: self.maybe_get_your_last_funding_locked_txid(),
10644+
my_current_funding_locked_txid: self.maybe_get_my_current_funding_locked_txid(),
1065810645
}
1065910646
}
1066010647

@@ -14517,15 +14504,15 @@ mod tests {
1451714504
// Now disconnect the two nodes and check that the commitment point in
1451814505
// Node B's channel_reestablish message is sane.
1451914506
assert!(node_b_chan.remove_uncommitted_htlcs_and_mark_paused(&&logger).is_ok());
14520-
let msg = node_b_chan.get_channel_reestablish(&channelmanager::provided_init_features(&config), &&logger);
14507+
let msg = node_b_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]);
1452414511

1452514512
// Check that the commitment point in Node A's channel_reestablish message
1452614513
// is sane.
1452714514
assert!(node_a_chan.remove_uncommitted_htlcs_and_mark_paused(&&logger).is_ok());
14528-
let msg = node_a_chan.get_channel_reestablish(&channelmanager::provided_init_features(&config), &&logger);
14515+
let msg = node_a_chan.get_channel_reestablish(&&logger);
1452914516
assert_eq!(msg.next_local_commitment_number, 1); // now called next_commitment_number
1453014517
assert_eq!(msg.next_remote_commitment_number, 0); // now called next_revocation_number
1453114518
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
@@ -12870,9 +12870,8 @@ where
1287012870
}
1287112871

1287212872
for (_, chan) in peer_state.channel_by_id.iter_mut() {
12873-
let features = &peer_state.latest_features;
1287412873
let logger = WithChannelContext::from(&self.logger, &chan.context(), None);
12875-
match chan.peer_connected_get_handshake(self.chain_hash, features, &&logger) {
12874+
match chan.peer_connected_get_handshake(self.chain_hash, &&logger) {
1287612875
ReconnectionMsg::Reestablish(msg) =>
1287712876
pending_msg_events.push(MessageSendEvent::SendChannelReestablish {
1287812877
node_id: chan.context().get_counterparty_node_id(),

0 commit comments

Comments
 (0)