X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fwire.rs;h=32447e8979e4a1e41fdcae7bb8e373c6bf17e3a4;hb=adc1b55a6fa064852d838ceb91b11e6b228d169e;hp=1191a8d3d531477977cad80776bb29f6c49ed2c8;hpb=4adff1039fd9ad0d7fca787af8fd6eb638c8e37a;p=rust-lightning diff --git a/lightning/src/ln/wire.rs b/lightning/src/ln/wire.rs index 1191a8d3..32447e89 100644 --- a/lightning/src/ln/wire.rs +++ b/lightning/src/ln/wire.rs @@ -12,9 +12,9 @@ //! //! [BOLT #1]: https://github.com/lightning/bolts/blob/master/01-messaging.md -use io; -use ln::msgs; -use util::ser::{Readable, Writeable, Writer}; +use crate::io; +use crate::ln::msgs; +use crate::util::ser::{Readable, Writeable, Writer}; /// Trait to be implemented by custom message (unrelated to the channel/gossip LN layers) /// decoders. @@ -42,7 +42,7 @@ pub(crate) trait TestEq {} impl TestEq for T {} -/// A Lightning message returned by [`read()`] when decoding bytes received over the wire. Each +/// A Lightning message returned by [`read`] when decoding bytes received over the wire. Each /// variant contains a message from [`msgs`] or otherwise the message type if unknown. #[allow(missing_docs)] #[derive(Debug)] @@ -81,7 +81,7 @@ pub(crate) enum Message where T: core::fmt::Debug + Type + TestEq { /// A message that could not be decoded because its type is unknown. Unknown(u16), /// A message that was produced by a [`CustomMessageReader`] and is to be handled by a - /// [`::ln::peer_handler::CustomMessageHandler`]. + /// [`crate::ln::peer_handler::CustomMessageHandler`]. Custom(T), } @@ -349,6 +349,50 @@ impl Encode for msgs::ClosingSigned { const TYPE: u16 = 39; } +impl Encode for msgs::OpenChannelV2 { + const TYPE: u16 = 64; +} + +impl Encode for msgs::AcceptChannelV2 { + const TYPE: u16 = 65; +} + +impl Encode for msgs::TxAddInput { + const TYPE: u16 = 66; +} + +impl Encode for msgs::TxAddOutput { + const TYPE: u16 = 67; +} + +impl Encode for msgs::TxRemoveInput { + const TYPE: u16 = 68; +} + +impl Encode for msgs::TxRemoveOutput { + const TYPE: u16 = 69; +} + +impl Encode for msgs::TxComplete { + const TYPE: u16 = 70; +} + +impl Encode for msgs::TxSignatures { + const TYPE: u16 = 71; +} + +impl Encode for msgs::TxInitRbf { + const TYPE: u16 = 72; +} + +impl Encode for msgs::TxAckRbf { + const TYPE: u16 = 73; +} + +impl Encode for msgs::TxAbort { + const TYPE: u16 = 74; +} + impl Encode for msgs::OnionMessage { const TYPE: u16 = 513; } @@ -424,9 +468,9 @@ impl Encode for msgs::GossipTimestampFilter { #[cfg(test)] mod tests { use super::*; - use prelude::*; + use crate::prelude::*; use core::convert::TryInto; - use ::ln::peer_handler::IgnoringMessageHandler; + use crate::ln::peer_handler::IgnoringMessageHandler; // Big-endian wire encoding of Pong message (type = 19, byteslen = 2). const ENCODED_PONG: [u8; 6] = [0u8, 19u8, 0u8, 2u8, 0u8, 0u8];