Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

lnutil: bolt 12 LnFeatures changes#10612

Open
f321x wants to merge 5 commits intospesmilo:masterspesmilo/electrum:masterfrom
f321x:bolt12_lnutil_additionsf321x/electrum-fork:bolt12_lnutil_additionsCopy head branch name to clipboard
Open

lnutil: bolt 12 LnFeatures changes#10612
f321x wants to merge 5 commits intospesmilo:masterspesmilo/electrum:masterfrom
f321x:bolt12_lnutil_additionsf321x/electrum-fork:bolt12_lnutil_additionsCopy head branch name to clipboard

Conversation

@f321x
Copy link
Copy Markdown
Member

@f321x f321x commented Apr 27, 2026

Changes to LnFeatures required for bolt 12.

  • route blinding flags
  • to_tlv_bytes helper method
  • context dependent features (e.g. BASIC_MPP_* without payment_secret dep)

Comment thread electrum/lnutil.py Outdated
Comment thread electrum/lnworker.py
Comment thread electrum/lnutil.py Outdated
Comment on lines +1808 to +1809
for flag in our_flags:
if flag not in their_flags and get_ln_flag_pair_of_bit(flag) not in their_flags:
if flag not in their_flags_effective and get_ln_flag_pair_of_bit(flag) not in their_flags_effective:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This would mean that even if the remote node did not signal e.g. option_dataloss_protect in their INIT message, we just ignore that, assume they support it, and proceed as usual. I find this behaviour surprising and have some doubts this is what the spec really means by "ASSUMED".

Copy link
Copy Markdown
Member Author

@f321x f321x Apr 29, 2026

Choose a reason for hiding this comment

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

Ok according to this PR comment, iiuc, the intention of marking features ASSUMED really seems to be to just assume they are there and, at one point, ignore them completely (as bolt 9 says).

However in practice this doesn't seem to be done by implementations, and e.g. sending INIT without an assumed feature flag would not be accepted anywhere. ASSUMED seems to mean more like "always required to be set" in practice.

Maybe spec compliant thing would be to ignore them when validating features but keep signaling them forever for compatibility. But then, there are still nodes that don't support these features, so it is probably not safe to just ignore them.

For now i removed this assumed thing from the PR. Instead to get the bolt 12 feature validation working i rely on context dependent transitive dependencies, which seems conceptually cleaner than relying on assumed features anyway.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does the spec plan to eventually reuse these feature bits? :D
This whole approach to "ASSUMED" just seems weird, and more trouble than is worth.
The reasonable thing would be to just burn the feature bits and require them to always be signalled.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Does the spec plan to eventually reuse these feature bits? :D

From my understanding of this comment it seems like a goal of the change is to eventually be able to fully remove these assumed feature bits from the spec. Once there is no reference to them anymore i assume they could also be reused:

This way, we'll eventually end up in a state where we can really assume those features and maybe even remove references to the feature bits they used (but maybe not 🤷). Meanwhile, we don't want to completely remove from the spec references to the fact that these features were at some point no assumed, and may or may not be supported.

@f321x f321x marked this pull request as draft April 28, 2026 15:57
@f321x f321x force-pushed the bolt12_lnutil_additions branch 2 times, most recently from 3e4c4d6 to f49030b Compare April 29, 2026 14:26
@f321x f321x changed the title lnutil: assumed lightning features, bolt 12 features lnutil: bolt 12 LnFeatures changes Apr 29, 2026
@f321x f321x marked this pull request as ready for review April 29, 2026 15:38
f321x and others added 5 commits May 4, 2026 12:43
Renames the "INVOICE" lightning feature context to "BOLT11_INVOICE"
as there is now a bolt 12 invoice feature context as well that differs.

Also adds 4 new bolt 12 context to the Enum.
Make transitive dependencies of lightning features context dependent.
This allows to validate different transitive dependencies for the same
feature in different contexts.
For example BASIC_MPP_* depends on payment_secret for bolt 11 invoices,
but has no dependencies when being used in the context of bolt 12 invoices.
Add missing LNWALLET_FEATUERS features to LN_FEATURES_IMPLEMENTED.
@f321x f321x force-pushed the bolt12_lnutil_additions branch from f49030b to 2586c57 Compare May 4, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.