Skip to content

Commit 56321de

Browse files
committed
Strip splice prototype bit when peering with ACINQ
LDK 0.2.2 renames the splice feature from prototype bit 155 to production bit 63. ACINQ has already moved to bit 63 and their eclair stack chokes when both bits are set on the same Init. We need dual-advertise to keep talking to un-upgraded clients on bit 155 once the LSP bumps, so hide bit 155 from ACINQ specifically. ChannelManager's BaseMessageHandler impl of provided_init_features already receives the counterparty pubkey but was discarding it; start using it. This is a no-op until the follow-up commit adds set_splicing_production_optional(). Today only bit 155 is set, and stripping it for ACINQ leaves nothing, which matches today's state (no splice with ACINQ either way). Refs MDK-799
1 parent 9f17217 commit 56321de

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

lightning/src/ln/channelmanager.rs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13711,8 +13711,10 @@ where
1371113711
provided_node_features(&self.config.read().unwrap())
1371213712
}
1371313713

13714-
fn provided_init_features(&self, _their_init_features: PublicKey) -> InitFeatures {
13715-
provided_init_features(&self.config.read().unwrap())
13714+
fn provided_init_features(&self, their_node_id: PublicKey) -> InitFeatures {
13715+
let mut features = provided_init_features(&self.config.read().unwrap());
13716+
strip_acinq_splice_prototype(&mut features, &their_node_id);
13717+
features
1371613718
}
1371713719

1371813720
#[rustfmt::skip]
@@ -15701,6 +15703,25 @@ pub(crate) fn provided_channel_type_features(config: &UserConfig) -> ChannelType
1570115703
ChannelTypeFeatures::from_init(&provided_init_features(config))
1570215704
}
1570315705

15706+
/// ACINQ mainnet node id. Eclair (ACINQ's stack) chokes on dual-advertise of
15707+
/// the splice prototype (bit 155) and production (bit 63) feature bits, so we
15708+
/// strip the prototype bit when peering with this specific node. ACINQ has
15709+
/// already moved to bit 63 so they will accept splice via the production bit.
15710+
/// See MDK-799.
15711+
const ACINQ_MAINNET_NODE_ID: [u8; 33] = [
15712+
0x03, 0x86, 0x4e, 0xf0, 0x25, 0xfd, 0xe8, 0xfb, 0x58, 0x7d, 0x98, 0x91, 0x86, 0xce, 0x6a, 0x4a,
15713+
0x18, 0x68, 0x95, 0xee, 0x44, 0xa9, 0x26, 0xbf, 0xc3, 0x70, 0xe2, 0xc3, 0x66, 0x59, 0x7a, 0x3f,
15714+
0x8f,
15715+
];
15716+
15717+
/// If `their_node_id` is the ACINQ mainnet node, clear the splice prototype
15718+
/// (bit 155) feature. See [`ACINQ_MAINNET_NODE_ID`] for context.
15719+
fn strip_acinq_splice_prototype(features: &mut InitFeatures, their_node_id: &PublicKey) {
15720+
if their_node_id.serialize() == ACINQ_MAINNET_NODE_ID {
15721+
features.clear_splicing();
15722+
}
15723+
}
15724+
1570415725
/// Fetches the set of [`InitFeatures`] flags that are provided by or required by
1570515726
/// [`ChannelManager`].
1570615727
pub fn provided_init_features(config: &UserConfig) -> InitFeatures {

0 commit comments

Comments
 (0)