Support for custom feature bits (lightning-custom-message, features)
https://github.com/lightningdevkit/rust-lightning/pull/2204
Host: dunxen -
Notes
- There are various locations in LN structures where support for certain functionality is advertised and made possible, as enumerated in bLIP-0002:
- Feature bits allows a node to publically advertise support for or requirement of a specific feature. Bits within the range
0-255are reserved for BOLTs and so can not be used for custom features.- These feature bits can appear in the following contexts
initmessage (minimally sizedfeaturefield bitmask)node_announcementmessage (minimally sizedfeaturefield bitmask)channel_announcementmessage (minimally sizedfeaturefield bitmask)- BOLT 11 invoices (bLIPs only in range
256-5114clarified by bLIPs#24 allowed_featuresfield of a blinded path
- These feature bits can appear in the following contexts
- LN message format: new message types can be used for custom features. Message types within the range
0-32767are reserved for BOLTs. Custom features (bLIPs) must use types in the range32768-65535. - TLV fields in BOLT messages: included in the trailing TLV stream of a BOLT message. bLIPs must use types greater than
65536.
- Feature bits allows a node to publically advertise support for or requirement of a specific feature. Bits within the range
- PR2204 adds the methods
provided_node_festures()andprovided_init_features()to theCustomMessageHandlertrait. Implementers are then able to set and provide their own features. - The PR also adds functionality for setting feature bits that are unknown to LDK with
Features::set_custom_bit(), but the bit must be in the custom range defined by bLIP 2 of course.
Questions
- Did you review the PR? Concept ACK, approach ACK, tested ACK, or NACK?
- What is the
CustomMessageHandlertrait and where do we delegate message handling to an implementer of this trait? - Why are custom feature bits in the invoice (I) context limited to the range
256-5114? Why don’t other feature contexts, such asinit,node_announcement, etc, have this specific restriction. - Other than specified in the notes, there is another restriction that applies to
Features::set_custom_bit()for bits in the custom range. What is it and how is it identified?