Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openingd: work harder to intuit OPT_SCID_ALIAS. #6304

Conversation

rustyrussell
Copy link
Contributor

option_scid_alias inside a channel_type allows for more private channels: in particular, it tells the peer that it MUST NOT allow routing via the real short channel id, and MUST use the alias.

It only makes sense (and is only permitted!) on unannounced channels.

Unfortunately, we didn't set this bit in the channel_type in v12.0 when it was introduced, instead relying on the presence of the feature bit with the peer. This was fixed in 23.05, but:

  1. Prior to 23.05 we didn't allow it to be set at all, and
  2. LND has a limited set of features they allow, and this isn't allowed without option_anchors_zero_fee_htlc_tx.

We could simply drop this channel_type until we merge anchors, but that has nasty privacy implications (you can probe the real channel id).

So, if we don't negotiate anchors (we don't!), we don't set this channel_type bit even if we want it, and intuit it, based on:

  1. Is this a non-anchor channel_type?
  2. Did we both send channel_type?
  3. Is this an unannounced channel?
  4. Did both peers announce support for scid aliases?

In addition, while looking at the previous backwards-compat code, I realized that v23.05 violated the spec and send accept_channel with OPT_SCID_ALIAS if it intuited it, even if it wasn't offered. Stop doing this, but allow our peers to.

Fixes: #6208

@rustyrussell rustyrussell added this to the v23.08 milestone Jun 5, 2023
@rustyrussell rustyrussell force-pushed the guilt/lnd-compat-no-scid-alias branch from 23e7711 to adeb7d8 Compare June 5, 2023 01:39
@rustyrussell rustyrussell mentioned this pull request Jun 5, 2023
Copy link
Member

@cdecker cdecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK adeb7d8

static bool intuit_scid_alias_type(struct state *state, u8 channel_flags,
bool peer_sent_channel_type)
{
/* Don't need to untuit if actually set */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/* Don't need to untuit if actually set */
/* Don't need to intuit if actually set */

option_scid_alias inside a channel_type allows for more private
channels: in particular, it tells the peer that it MUST NOT allow
routing via the real short channel id, and MUST use the alias.

It only makes sense (and is only permitted!) on unannounced channels.

Unfortunately, we didn't set this bit in the channel_type in v12.0
when it was introduced, instead relying on the presence of the feature
bit with the peer.  This was fixed in 23.05, but:

1. Prior to 23.05 we didn't allow it to be set at all, and
2. LND has a limited set of features they allow, and this isn't allowed without
   option_anchors_zero_fee_htlc_tx.

We could simply drop this channel_type until we merge anchors, *but*
that has nasty privacy implications (you can probe the real channel id).

So, if we don't negotiate anchors (we don't!), we don't set this
channel_type bit even if we want it, and *intuit* it, based on:

1. Is this a non-anchor channel_type?
2. Did we both send channel_type?
3. Is this an unannounced channel?
4. Did both peers announce support for scid aliases?

In addition, while looking at the previous backwards-compat code, I
realized that v23.05 violated the spec and send accept_channel with
OPT_SCID_ALIAS if it intuited it, even if it wasn't offered.  Stop
doing this, but allow our peers to.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: Fix incompatibility with LND which prevented us opening private channels
Fixes: ElementsProject#6208
@rustyrussell rustyrussell force-pushed the guilt/lnd-compat-no-scid-alias branch from adeb7d8 to 96e4c90 Compare June 6, 2023 02:31
@rustyrussell
Copy link
Contributor Author

rustyrussell commented Jun 6, 2023

Pushed with typo fix from @cdecker.

Ack 96e4c90

Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 96e4c90

@rustyrussell rustyrussell force-pushed the guilt/lnd-compat-no-scid-alias branch from d283f14 to 96e4c90 Compare June 8, 2023 00:22
@rustyrussell rustyrussell merged commit 2d53707 into ElementsProject:master Jun 9, 2023
59 of 61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLN no longer opens Zero Conf Channels to LND
3 participants