|
43 | 43 | //! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message) for more information).
|
44 | 44 | //! - `ShutdownAnySegwit` - requires/supports that future segwit versions are allowed in `shutdown`
|
45 | 45 | //! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md) for more information).
|
| 46 | +//! - `OnionMessages` - requires/supports forwarding onion messages |
| 47 | +//! (see [BOLT-7](https://github.com/lightning/bolts/pull/759/files) for more information). |
| 48 | +//! TODO: update link |
46 | 49 | //! - `ChannelType` - node supports the channel_type field in open/accept
|
47 | 50 | //! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md) for more information).
|
48 | 51 | //! - `SCIDPrivacy` - supply channel aliases for routing
|
@@ -174,7 +177,7 @@ mod sealed {
|
174 | 177 | // Byte 3
|
175 | 178 | ShutdownAnySegwit,
|
176 | 179 | // Byte 4
|
177 |
| - , |
| 180 | + OnionMessages, |
178 | 181 | // Byte 5
|
179 | 182 | ChannelType | SCIDPrivacy,
|
180 | 183 | // Byte 6
|
@@ -208,7 +211,7 @@ mod sealed {
|
208 | 211 | // Byte 3
|
209 | 212 | ShutdownAnySegwit,
|
210 | 213 | // Byte 4
|
211 |
| - , |
| 214 | + OnionMessages, |
212 | 215 | // Byte 5
|
213 | 216 | ChannelType | SCIDPrivacy,
|
214 | 217 | // Byte 6
|
@@ -435,8 +438,6 @@ mod sealed {
|
435 | 438 | define_feature!(27, ShutdownAnySegwit, [InitContext, NodeContext],
|
436 | 439 | "Feature flags for `opt_shutdown_anysegwit`.", set_shutdown_any_segwit_optional,
|
437 | 440 | set_shutdown_any_segwit_required, supports_shutdown_anysegwit, requires_shutdown_anysegwit);
|
438 |
| - // We do not yet advertise the onion messages feature bit, but we need to detect when peers |
439 |
| - // support it. |
440 | 441 | define_feature!(39, OnionMessages, [InitContext, NodeContext],
|
441 | 442 | "Feature flags for `option_onion_messages`.", set_onion_messages_optional,
|
442 | 443 | set_onion_messages_required, supports_onion_messages, requires_onion_messages);
|
@@ -908,6 +909,11 @@ mod tests {
|
908 | 909 | assert!(!InitFeatures::known().requires_wumbo());
|
909 | 910 | assert!(!NodeFeatures::known().requires_wumbo());
|
910 | 911 |
|
| 912 | + assert!(InitFeatures::known().supports_onion_messages()); |
| 913 | + assert!(NodeFeatures::known().supports_onion_messages()); |
| 914 | + assert!(!InitFeatures::known().requires_onion_messages()); |
| 915 | + assert!(!NodeFeatures::known().requires_onion_messages()); |
| 916 | + |
911 | 917 | assert!(InitFeatures::known().supports_zero_conf());
|
912 | 918 | assert!(!InitFeatures::known().requires_zero_conf());
|
913 | 919 | assert!(NodeFeatures::known().supports_zero_conf());
|
@@ -952,15 +958,15 @@ mod tests {
|
952 | 958 | // - var_onion_optin (req) | static_remote_key (req) | payment_secret(req)
|
953 | 959 | // - basic_mpp | wumbo
|
954 | 960 | // - opt_shutdown_anysegwit
|
955 |
| - // - |
| 961 | + // - onion_messages |
956 | 962 | // - option_channel_type | option_scid_alias
|
957 | 963 | // - option_zeroconf
|
958 | 964 | assert_eq!(node_features.flags.len(), 7);
|
959 | 965 | assert_eq!(node_features.flags[0], 0b00000010);
|
960 | 966 | assert_eq!(node_features.flags[1], 0b01010001);
|
961 | 967 | assert_eq!(node_features.flags[2], 0b00001010);
|
962 | 968 | assert_eq!(node_features.flags[3], 0b00001000);
|
963 |
| - assert_eq!(node_features.flags[4], 0b00000000); |
| 969 | + assert_eq!(node_features.flags[4], 0b10000000); |
964 | 970 | assert_eq!(node_features.flags[5], 0b10100000);
|
965 | 971 | assert_eq!(node_features.flags[6], 0b00001000);
|
966 | 972 | }
|
|
0 commit comments