|
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
|
@@ -177,7 +180,7 @@ mod sealed {
|
177 | 180 | // Byte 3
|
178 | 181 | ShutdownAnySegwit,
|
179 | 182 | // Byte 4
|
180 |
| - , |
| 183 | + OnionMessages, |
181 | 184 | // Byte 5
|
182 | 185 | ChannelType | SCIDPrivacy,
|
183 | 186 | // Byte 6
|
@@ -211,7 +214,7 @@ mod sealed {
|
211 | 214 | // Byte 3
|
212 | 215 | ShutdownAnySegwit,
|
213 | 216 | // Byte 4
|
214 |
| - , |
| 217 | + OnionMessages, |
215 | 218 | // Byte 5
|
216 | 219 | ChannelType | SCIDPrivacy,
|
217 | 220 | // Byte 6
|
@@ -438,8 +441,6 @@ mod sealed {
|
438 | 441 | define_feature!(27, ShutdownAnySegwit, [InitContext, NodeContext],
|
439 | 442 | "Feature flags for `opt_shutdown_anysegwit`.", set_shutdown_any_segwit_optional,
|
440 | 443 | set_shutdown_any_segwit_required, supports_shutdown_anysegwit, requires_shutdown_anysegwit);
|
441 |
| - // We do not yet advertise the onion messages feature bit, but we need to detect when peers |
442 |
| - // support it. |
443 | 444 | define_feature!(39, OnionMessages, [InitContext, NodeContext],
|
444 | 445 | "Feature flags for `option_onion_messages`.", set_onion_messages_optional,
|
445 | 446 | set_onion_messages_required, supports_onion_messages, requires_onion_messages);
|
@@ -924,6 +925,11 @@ mod tests {
|
924 | 925 | assert!(!InitFeatures::known().requires_wumbo());
|
925 | 926 | assert!(!NodeFeatures::known().requires_wumbo());
|
926 | 927 |
|
| 928 | + assert!(InitFeatures::known().supports_onion_messages()); |
| 929 | + assert!(NodeFeatures::known().supports_onion_messages()); |
| 930 | + assert!(!InitFeatures::known().requires_onion_messages()); |
| 931 | + assert!(!NodeFeatures::known().requires_onion_messages()); |
| 932 | + |
927 | 933 | assert!(InitFeatures::known().supports_zero_conf());
|
928 | 934 | assert!(!InitFeatures::known().requires_zero_conf());
|
929 | 935 | assert!(NodeFeatures::known().supports_zero_conf());
|
@@ -968,15 +974,15 @@ mod tests {
|
968 | 974 | // - var_onion_optin (req) | static_remote_key (req) | payment_secret(req)
|
969 | 975 | // - basic_mpp | wumbo
|
970 | 976 | // - opt_shutdown_anysegwit
|
971 |
| - // - |
| 977 | + // - onion_messages |
972 | 978 | // - option_channel_type | option_scid_alias
|
973 | 979 | // - option_zeroconf
|
974 | 980 | assert_eq!(node_features.flags.len(), 7);
|
975 | 981 | assert_eq!(node_features.flags[0], 0b00000010);
|
976 | 982 | assert_eq!(node_features.flags[1], 0b01010001);
|
977 | 983 | assert_eq!(node_features.flags[2], 0b00001010);
|
978 | 984 | assert_eq!(node_features.flags[3], 0b00001000);
|
979 |
| - assert_eq!(node_features.flags[4], 0b00000000); |
| 985 | + assert_eq!(node_features.flags[4], 0b10000000); |
980 | 986 | assert_eq!(node_features.flags[5], 0b10100000);
|
981 | 987 | assert_eq!(node_features.flags[6], 0b00001000);
|
982 | 988 | }
|
|
0 commit comments