pub trait UpfrontShutdownScript: Context {}
impl UpfrontShutdownScript for InitContext {}
impl UpfrontShutdownScript for NodeContext {}
+
+ pub trait VariableLengthOnion: Context {}
+ impl VariableLengthOnion for InitContext {}
+ impl VariableLengthOnion for NodeContext {}
}
/// Tracks the set of features which a node implements, templated by the context in which it
/// Create a Features with the features we support
pub fn supported() -> InitFeatures {
InitFeatures {
- flags: vec![2 | 1 << 5],
+ flags: vec![2 | 1 << 5, 1 << (9-8)],
mark: PhantomData,
}
}
#[cfg(not(feature = "fuzztarget"))]
pub(crate) fn supported() -> NodeFeatures {
NodeFeatures {
- flags: vec![2 | 1 << 5],
+ flags: vec![2 | 1 << 5, 1 << (9-8)],
mark: PhantomData,
}
}
#[cfg(feature = "fuzztarget")]
pub fn supported() -> NodeFeatures {
NodeFeatures {
- flags: vec![2 | 1 << 5],
+ flags: vec![2 | 1 << 5, 1 << (9-8)],
mark: PhantomData,
}
}
}
}
+impl<T: sealed::VariableLengthOnion> Features<T> {
+ pub(crate) fn supports_variable_length_onion(&self) -> bool {
+ self.flags.len() > 1 && (self.flags[1] & 3) != 0
+ }
+}
+
impl<T: sealed::InitialRoutingSync> Features<T> {
pub(crate) fn initial_routing_sync(&self) -> bool {
self.flags.len() > 0 && (self.flags[0] & (1 << 3)) != 0