-
Notifications
You must be signed in to change notification settings - Fork 525
Flat features: far simpler solution for feature bits. #666
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -371,3 +371,4 @@ tlvs | |
| snprintf | ||
| GitHub | ||
| IRC | ||
| bitmasks | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,44 +1,53 @@ | ||
| # BOLT #9: Assigned Feature Flags | ||
|
|
||
| This document tracks the assignment of `localfeatures` and `globalfeatures` | ||
| flags in the `init` message ([BOLT #1](01-messaging.md)) along with the | ||
| `features` flag fields in the `channel_announcement` and `node_announcement` | ||
| messages ([BOLT #7](07-routing-gossip.md)). | ||
| The flags are tracked separately, since new flags will likely be added over time. | ||
|
|
||
| The `features` flags in the routing messages are a subset of the | ||
| `globalfeatures` flags, as `localfeatures`, by definition, are only of interest | ||
| to direct peers. | ||
| This document tracks the assignment of `features` flags in the `init` | ||
| message ([BOLT #1](01-messaging.md)), as well as `features` fields in | ||
| the `channel_announcement` and `node_announcement` messages ([BOLT | ||
| #7](07-routing-gossip.md)). The flags are tracked separately, since | ||
| new flags will likely be added over time. | ||
|
|
||
| Flags are numbered from the least-significant bit, at bit 0 (i.e. 0x1, | ||
| an _even_ bit). They are generally assigned in pairs so that features | ||
| can be introduced as optional (_odd_ bits) and later upgraded to be compulsory | ||
| (_even_ bits), which will be refused by outdated nodes: | ||
| see [BOLT #1: The `init` Message](01-messaging.md#the-init-message). | ||
|
|
||
| ## Assigned `localfeatures` flags | ||
|
|
||
| These flags may only be used in the `init` message: | ||
|
|
||
| | Bits | Name | Description | Link | | ||
| |-------|----------------------------------|---------------------------------------------------------------------------|------------------------------| | ||
| | 0/1 | `option_data_loss_protect` | Requires or supports extra `channel_reestablish` fields | [BOLT #2][bolt02-retransmit] | | ||
| | 3 | `initial_routing_sync` | Indicates that the sending node needs a complete routing information dump | [BOLT #7][bolt07-sync] | | ||
| | 4/5 | `option_upfront_shutdown_script` | Commits to a shutdown scriptpubkey when opening channel | [BOLT #2][bolt02-open] | | ||
| | 6/7 | `gossip_queries` | More sophisticated gossip control | [BOLT #7][bolt07-query] | | ||
| | 10/11 | `gossip_queries_ex` | Gossip queries can include additional information | [BOLT #7][bolt07-query] | | ||
| | 12/13| `option_static_remotekey` | Static key for remote output | [BOLT #3](03-transactions.md) | | ||
| Some features don't make sense on a per-channels or per-node basis, so | ||
| each feature defines how it is presented in those contexts. Some | ||
| features may be required for opening a channel, but not a requirement | ||
| for use of the channel, so the presentation of those features depends | ||
| on the feature itself. | ||
|
|
||
| ## Assigned `globalfeatures` flags | ||
| The Context column decodes as follows: | ||
| * `I`: presented in the `init` message. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is Should we carve out the space for invoice feature bits as well in this PR?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. from the candidate features, we could start to specify that
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think your first comment raises an interesting point to discuss: do we want to merge invoice feature bits with node feature bits? If we do #643 can't use bits 0-3 (which it currently does) since it clashes with node features. I think it may be useful to merge invoice feature bits with node feature bits as it sounds more future-proof. The only downside I can see is that it uses more space in the invoice, so QR codes might end up being big. But we can probably compress the features bitfield quite efficiently if it becomes large but we only want to set a few bits in it. WDYT?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. at this point I think we should forbid colliding feature bits altogether, so all feature bit spaces should share the same namespace. however there are some node features that don’t make sense as invoice features, e.g. support for gossip sync protocols, and those don’t need to be present. the space for routing hints will probably dwarf the feature bits in the invoice for some time, but agree that a more space efficient representation for feature bits is worth exploring. I’ve been looking into a combination of RLE and/or sparse encodings, tho the more difficult task will be signaling support for the newer format without parsing any feature bits, but we have options :P
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Feature-bit-ception 💥 |
||
| * `N`: presented in the `node_announcement` messages | ||
| * `C`: presented in the `channel_announcement` message. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about the channel update message? We also need possibly extend the existing hop hints to also encompass this information. One could say the current set of feature bits handles that, however it's possible to provide multiple hop hints, and each of those channels could themselves advertise/require distinct sets of hop hints.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't have a general feature field in channel_update (yet?). But we can add a field if we need to.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the main thing here is the inability to express distinct feature sets for each channel with the current BOLT 11 feature bit vector extension. |
||
| * `C-`: presented in the `channel_announcement` message, but always odd (optional). | ||
| * `C+`: presented in the `channel_announcement` message, but always even (required). | ||
| * `9`: presented in [BOLT 11](11-payment-encoding.md) invoices. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this mean that invoice features will share the same namespace as everything else? i think that's the right call, should
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, #643 does this (or will, once rebased on this) |
||
|
|
||
| The following `globalfeatures` bits are currently assigned by this specification: | ||
|
|
||
| | Bits | Name | Description | Link | | ||
| |------|-------------------|--------------------------------------------------------------------|---------------------------------------| | ||
| | 8/9 | `var_onion_optin` | This node requires/supports variable-length routing onion payloads | [Routing Onion Specification][bolt04] | | ||
| | Bits | Name | Description | Context | Link | | ||
| |-------|----------------------------------|-----------------------------------------------------------|----------|---------------------------------------| | ||
| | 0/1 | `option_data_loss_protect` | Requires or supports extra `channel_reestablish` fields | IN | [BOLT #2][bolt02-retransmit] | | ||
| | 3 | `initial_routing_sync` | Sending node needs a complete routing information dump | I | [BOLT #7][bolt07-sync] | | ||
| | 4/5 | `option_upfront_shutdown_script` | Commits to a shutdown scriptpubkey when opening channel | IN | [BOLT #2][bolt02-open] | | ||
| | 6/7 | `gossip_queries` | More sophisticated gossip control | IN | [BOLT #7][bolt07-query] | | ||
| | 8/9 | `var_onion_optin` | Requires/supports variable-length routing onion payloads | IN | [Routing Onion Specification][bolt04] | | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why should a node level feature gate if two peers can/will-continue-to communicate on the connection level? As is, if I went to open a channel with a peer that doesn't support the new onion payload, but they required this bit, then the connection would fail upon feature bit comparison.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's overbroad: this is the tradeoff. Previously you could in theory gossip with a node which had an even global feature you didn't like, too. Putting it in the channel_announce would also be overbroad (since both nodes might not need it). We could add a feature bitfield (TLV-style) to channel_update, but it's marginally more efficient to use node_announce, since it's really per-node not per channel in any sane implementation. Did we want to go there?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're not using it either for p2p, it will currently only be useful in the Bolt 11 invoice or inferred by other feature bits (MPP, Trampoline, etc). |
||
| | 10/11 | `gossip_queries_ex` | Gossip queries can include additional information | IN | [BOLT #7][bolt07-query] | | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing 12/13 for |
||
| | 12/13| `option_static_remotekey` | Static key for remote output | IN | [BOLT #3](03-transactions.md) | | ||
|
|
||
| ## Requirements | ||
|
|
||
| The origin node: | ||
| * If it supports a feature above, SHOULD set the corresponding odd | ||
| bit in all feature fields indicated by the Context column unless | ||
| indicated that it must set the even feature bit instead. | ||
| * If it requires a feature above, MUST set the corresponding even | ||
| feature bit in all feature fields indicated by the Context column, | ||
| unless indicated that it must set the odd feature bit instead. | ||
| * MUST NOT set feature bits it does not support. | ||
| * MUST NOT set feature bits in fields not specified by the table above. | ||
|
|
||
| The requirements for receiving specific bits are defined in the linked sections in the table above. | ||
| The requirements for feature bits that are not defined | ||
| above can be found in [BOLT #1: The `init` Message](01-messaging.md#the-init-message). | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.