|
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);
|
@@ -925,6 +926,11 @@ mod tests {
|
925 | 926 | assert!(!InitFeatures::known().requires_wumbo());
|
926 | 927 | assert!(!NodeFeatures::known().requires_wumbo());
|
927 | 928 |
|
| 929 | + assert!(InitFeatures::known().supports_onion_messages()); |
| 930 | + assert!(NodeFeatures::known().supports_onion_messages()); |
| 931 | + assert!(!InitFeatures::known().requires_onion_messages()); |
| 932 | + assert!(!NodeFeatures::known().requires_onion_messages()); |
| 933 | + |
928 | 934 | assert!(InitFeatures::known().supports_zero_conf());
|
929 | 935 | assert!(!InitFeatures::known().requires_zero_conf());
|
930 | 936 | assert!(NodeFeatures::known().supports_zero_conf());
|
@@ -969,15 +975,15 @@ mod tests {
|
969 | 975 | // - var_onion_optin (req) | static_remote_key (req) | payment_secret(req)
|
970 | 976 | // - basic_mpp | wumbo
|
971 | 977 | // - opt_shutdown_anysegwit
|
972 |
| - // - |
| 978 | + // - onion_messages |
973 | 979 | // - option_channel_type | option_scid_alias
|
974 | 980 | // - option_zeroconf
|
975 | 981 | assert_eq!(node_features.flags.len(), 7);
|
976 | 982 | assert_eq!(node_features.flags[0], 0b00000010);
|
977 | 983 | assert_eq!(node_features.flags[1], 0b01010001);
|
978 | 984 | assert_eq!(node_features.flags[2], 0b00001010);
|
979 | 985 | assert_eq!(node_features.flags[3], 0b00001000);
|
980 |
| - assert_eq!(node_features.flags[4], 0b00000000); |
| 986 | + assert_eq!(node_features.flags[4], 0b10000000); |
981 | 987 | assert_eq!(node_features.flags[5], 0b10100000);
|
982 | 988 | assert_eq!(node_features.flags[6], 0b00001000);
|
983 | 989 | }
|
|
0 commit comments