+struct TestCustomMessage {}
+
+const CUSTOM_MESSAGE_TYPE: u64 = 4242;
+const CUSTOM_MESSAGE_CONTENTS: [u8; 32] = [42; 32];
+
+impl CustomOnionMessageContents for TestCustomMessage {
+ fn tlv_type(&self) -> u64 {
+ CUSTOM_MESSAGE_TYPE
+ }
+}
+
+impl Writeable for TestCustomMessage {
+ fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
+ Ok(CUSTOM_MESSAGE_CONTENTS.write(w)?)
+ }
+}
+
+struct TestCustomMessageHandler {}
+
+impl CustomOnionMessageHandler for TestCustomMessageHandler {
+ type CustomMessage = TestCustomMessage;
+ fn handle_custom_message(&self, _msg: Self::CustomMessage) {}
+ fn read_custom_message<R: io::Read>(&self, _message_type: u64, buffer: &mut R) -> Result<Option<Self::CustomMessage>, msgs::DecodeError> {
+ let mut buf = Vec::new();
+ buffer.read_to_end(&mut buf)?;
+ return Ok(Some(TestCustomMessage {}))
+ }
+}
+