//! `Foo` and `Bar` messages, and further composing it with a handler for `Baz` messages.
//!
//!```
+//! # fn main() {} // Avoid #[macro_export] generating an in-function warning
//! # extern crate bitcoin;
//! extern crate lightning;
//! #[macro_use]
//! # use bitcoin::secp256k1::PublicKey;
//! # use lightning::io;
//! # use lightning::ln::msgs::{DecodeError, LightningError};
+//! # use lightning::ln::features::{InitFeatures, NodeFeatures};
//! use lightning::ln::peer_handler::CustomMessageHandler;
//! use lightning::ln::wire::{CustomMessageReader, self};
//! use lightning::util::ser::Writeable;
//! # fn get_and_clear_pending_msg(&self) -> Vec<(PublicKey, Self::CustomMessage)> {
//! # unimplemented!()
//! # }
+//! # fn provided_node_features(&self) -> NodeFeatures {
+//! # unimplemented!()
+//! # }
+//! # fn provided_init_features(&self, _their_node_id: &PublicKey) -> InitFeatures {
+//! # unimplemented!()
+//! # }
//! }
//!
//! #[derive(Debug)]
//! # fn get_and_clear_pending_msg(&self) -> Vec<(PublicKey, Self::CustomMessage)> {
//! # unimplemented!()
//! # }
+//! # fn provided_node_features(&self) -> NodeFeatures {
+//! # unimplemented!()
+//! # }
+//! # fn provided_init_features(&self, _their_node_id: &PublicKey) -> InitFeatures {
+//! # unimplemented!()
+//! # }
//! }
//!
//! #[derive(Debug)]
//! # fn get_and_clear_pending_msg(&self) -> Vec<(PublicKey, Self::CustomMessage)> {
//! # unimplemented!()
//! # }
+//! # fn provided_node_features(&self) -> NodeFeatures {
+//! # unimplemented!()
+//! # }
+//! # fn provided_init_features(&self, _their_node_id: &PublicKey) -> InitFeatures {
+//! # unimplemented!()
+//! # }
//! }
//!
-//! # fn main() {
//! // The first crate may define a handler composing `FooHandler` and `BarHandler` and export the
//! // corresponding message type ids as a macro to use in further composition.
//!
//! macro_rules! foo_bar_baz_type_ids {
//! () => { foo_bar_type_ids!() | baz_type_id!() }
//! }
-//! # }
//!```
//!
//! [BOLT 1]: https://github.com/lightning/bolts/blob/master/01-messaging.md
)*
.collect()
}
+
+ fn provided_node_features(&self) -> $crate::lightning::ln::features::NodeFeatures {
+ $crate::lightning::ln::features::NodeFeatures::empty()
+ $(
+ | self.$field.provided_node_features()
+ )*
+ }
+
+ fn provided_init_features(
+ &self, their_node_id: &$crate::bitcoin::secp256k1::PublicKey
+ ) -> $crate::lightning::ln::features::InitFeatures {
+ $crate::lightning::ln::features::InitFeatures::empty()
+ $(
+ | self.$field.provided_init_features(their_node_id)
+ )*
+ }
}
impl $crate::lightning::ln::wire::CustomMessageReader for $handler {