X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fwire.rs;h=1ceb38c7499642128480c1a8d0f4b03912842711;hb=b9b43ce5c8cb3216d1459944c6f0d48d8c37243f;hp=1191a8d3d531477977cad80776bb29f6c49ed2c8;hpb=99123cd91a5b0a8f8b6a7ec7a5ac323d2b4093c1;p=rust-lightning diff --git a/lightning/src/ln/wire.rs b/lightning/src/ln/wire.rs index 1191a8d3..1ceb38c7 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. @@ -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), } @@ -276,13 +276,13 @@ pub(crate) use self::encode::Encode; /// Defines a type identifier for sending messages over the wire. /// /// Messages implementing this trait specify a type and must be [`Writeable`]. -pub trait Type: core::fmt::Debug + Writeable { +pub trait Type: core::fmt::Debug + Writeable + Clone { /// Returns the type identifying the message payload. fn type_id(&self) -> u16; } #[cfg(test)] -pub trait Type: core::fmt::Debug + Writeable + PartialEq { +pub trait Type: core::fmt::Debug + Writeable + Clone + PartialEq { fn type_id(&self) -> u16; } @@ -292,12 +292,12 @@ impl Type for () { } #[cfg(test)] -impl Type for T where T: Encode { +impl Type for T where T: Encode { fn type_id(&self) -> u16 { T::TYPE } } #[cfg(not(test))] -impl Type for T where T: Encode { +impl Type for T where T: Encode { fn type_id(&self) -> u16 { T::TYPE } } @@ -424,9 +424,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]; @@ -583,7 +583,7 @@ mod tests { } } - #[derive(Eq, PartialEq, Debug)] + #[derive(Clone, Eq, PartialEq, Debug)] struct TestCustomMessage {} const CUSTOM_MESSAGE_TYPE : u16 = 9000;