Skip to content

Commit 2c790d0

Browse files
committed
f - don't check splice feature bit
1 parent fa4c9c9 commit 2c790d0

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
@@ -1665,12 +1665,12 @@ where
16651665
/// send our peer to begin the channel reconnection process.
16661666
#[rustfmt::skip]
16671667
pub fn peer_connected_get_handshake<L: Deref>(
1668-
&mut self, chain_hash: ChainHash, their_features: &InitFeatures, logger: &L,
1668+
&mut self, chain_hash: ChainHash, logger: &L,
16691669
) -> ReconnectionMsg where L::Target: Logger {
16701670
match &mut self.phase {
16711671
ChannelPhase::Undefined => unreachable!(),
16721672
ChannelPhase::Funded(chan) =>
1673-
ReconnectionMsg::Reestablish(chan.get_channel_reestablish(their_features, logger)),
1673+
ReconnectionMsg::Reestablish(chan.get_channel_reestablish(logger)),
16741674
ChannelPhase::UnfundedOutboundV1(chan) => {
16751675
chan.get_open_channel(chain_hash, logger)
16761676
.map(|msg| ReconnectionMsg::Open(OpenChannelMessage::V1(msg)))
@@ -10136,11 +10136,7 @@ where
1013610136
}
1013710137

1013810138
#[cfg(splicing)]
10139-
fn maybe_get_your_last_funding_locked_txid(&self, features: &InitFeatures) -> Option<Txid> {
10140-
if !features.supports_splicing() {
10141-
return None;
10142-
}
10143-
10139+
fn maybe_get_your_last_funding_locked_txid(&self) -> Option<Txid> {
1014410140
self.pending_splice
1014510141
.as_ref()
1014610142
.and_then(|pending_splice| pending_splice.received_funding_txid)
@@ -10149,16 +10145,12 @@ where
1014910145
})
1015010146
}
1015110147
#[cfg(not(splicing))]
10152-
fn maybe_get_your_last_funding_locked_txid(&self, _features: &InitFeatures) -> Option<Txid> {
10148+
fn maybe_get_your_last_funding_locked_txid(&self) -> Option<Txid> {
1015310149
None
1015410150
}
1015510151

1015610152
#[cfg(splicing)]
10157-
fn maybe_get_my_current_funding_locked_txid(&self, features: &InitFeatures) -> Option<Txid> {
10158-
if !features.supports_splicing() {
10159-
return None;
10160-
}
10161-
10153+
fn maybe_get_my_current_funding_locked_txid(&self) -> Option<Txid> {
1016210154
self.pending_splice
1016310155
.as_ref()
1016410156
.and_then(|pending_splice| pending_splice.sent_funding_txid)
@@ -10168,19 +10160,14 @@ where
1016810160
}
1016910161

1017010162
#[cfg(not(splicing))]
10171-
fn maybe_get_my_current_funding_locked_txid(&self, _features: &InitFeatures) -> Option<Txid> {
10163+
fn maybe_get_my_current_funding_locked_txid(&self) -> Option<Txid> {
1017210164
None
1017310165
}
1017410166

1017510167
/// May panic if called on a channel that wasn't immediately-previously
1017610168
/// self.remove_uncommitted_htlcs_and_mark_paused()'d
1017710169
#[rustfmt::skip]
10178-
fn get_channel_reestablish<L: Deref>(
10179-
&mut self, their_features: &InitFeatures, logger: &L,
10180-
) -> msgs::ChannelReestablish
10181-
where
10182-
L::Target: Logger,
10183-
{
10170+
fn get_channel_reestablish<L: Deref>(&mut self, logger: &L) -> msgs::ChannelReestablish where L::Target: Logger {
1018410171
assert!(self.context.channel_state.is_peer_disconnected());
1018510172
assert_ne!(self.context.cur_counterparty_commitment_transaction_number, INITIAL_COMMITMENT_NUMBER);
1018610173
// This is generally the first function which gets called on any given channel once we're
@@ -10228,8 +10215,8 @@ where
1022810215
your_last_per_commitment_secret: remote_last_secret,
1022910216
my_current_per_commitment_point: dummy_pubkey,
1023010217
next_funding_txid: self.maybe_get_next_funding_txid(),
10231-
your_last_funding_locked_txid: self.maybe_get_your_last_funding_locked_txid(their_features),
10232-
my_current_funding_locked_txid: self.maybe_get_my_current_funding_locked_txid(their_features),
10218+
your_last_funding_locked_txid: self.maybe_get_your_last_funding_locked_txid(),
10219+
my_current_funding_locked_txid: self.maybe_get_my_current_funding_locked_txid(),
1023310220
}
1023410221
}
1023510222

@@ -13740,15 +13727,15 @@ mod tests {
1374013727
// Now disconnect the two nodes and check that the commitment point in
1374113728
// Node B's channel_reestablish message is sane.
1374213729
assert!(node_b_chan.remove_uncommitted_htlcs_and_mark_paused(&&logger).is_ok());
13743-
let msg = node_b_chan.get_channel_reestablish(&channelmanager::provided_init_features(&config), &&logger);
13730+
let msg = node_b_chan.get_channel_reestablish(&&logger);
1374413731
assert_eq!(msg.next_local_commitment_number, 1); // now called next_commitment_number
1374513732
assert_eq!(msg.next_remote_commitment_number, 0); // now called next_revocation_number
1374613733
assert_eq!(msg.your_last_per_commitment_secret, [0; 32]);
1374713734

1374813735
// Check that the commitment point in Node A's channel_reestablish message
1374913736
// is sane.
1375013737
assert!(node_a_chan.remove_uncommitted_htlcs_and_mark_paused(&&logger).is_ok());
13751-
let msg = node_a_chan.get_channel_reestablish(&channelmanager::provided_init_features(&config), &&logger);
13738+
let msg = node_a_chan.get_channel_reestablish(&&logger);
1375213739
assert_eq!(msg.next_local_commitment_number, 1); // now called next_commitment_number
1375313740
assert_eq!(msg.next_remote_commitment_number, 0); // now called next_revocation_number
1375413741
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
@@ -12007,9 +12007,8 @@ where
1200712007
}
1200812008

1200912009
for (_, chan) in peer_state.channel_by_id.iter_mut() {
12010-
let features = &peer_state.latest_features;
1201112010
let logger = WithChannelContext::from(&self.logger, &chan.context(), None);
12012-
match chan.peer_connected_get_handshake(self.chain_hash, features, &&logger) {
12011+
match chan.peer_connected_get_handshake(self.chain_hash, &&logger) {
1201312012
ReconnectionMsg::Reestablish(msg) =>
1201412013
pending_msg_events.push(MessageSendEvent::SendChannelReestablish {
1201512014
node_id: chan.context().get_counterparty_node_id(),

0 commit comments

Comments
 (0)