]> git.bitcoin.ninja Git - rust-lightning/blobdiff - lightning/src/ln/wire.rs
Merge pull request #2680 from TheBlueMatt/2023-10-0.0.118-bindings
[rust-lightning] / lightning / src / ln / wire.rs
index 88e2ad7c1daee03ef245c795f0119eb229a10520..e982a2aec0da3b504a32dbc10b9b5f9662cfb229 100644 (file)
@@ -45,9 +45,9 @@ impl<T> TestEq for T {}
 /// 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)]
+#[derive(Clone, Debug)]
 #[cfg_attr(test, derive(PartialEq))]
-pub(crate) enum Message<T> where T: core::fmt::Debug + Type + TestEq {
+pub(crate) enum Message<T> where T: Clone + core::fmt::Debug + Type + TestEq {
        Init(msgs::Init),
        Error(msgs::ErrorMessage),
        Warning(msgs::WarningMessage),
@@ -383,13 +383,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;
 }
 
@@ -399,12 +399,12 @@ impl Type for () {
 }
 
 #[cfg(test)]
-impl<T: core::fmt::Debug + Writeable + PartialEq> Type for T where T: Encode {
+impl<T: core::fmt::Debug + Writeable + Clone + PartialEq> Type for T where T: Encode {
        fn type_id(&self) -> u16 { T::TYPE }
 }
 
 #[cfg(not(test))]
-impl<T: core::fmt::Debug + Writeable> Type for T where T: Encode {
+impl<T: core::fmt::Debug + Writeable + Clone> Type for T where T: Encode {
        fn type_id(&self) -> u16 { T::TYPE }
 }
 
@@ -734,7 +734,7 @@ mod tests {
                }
        }
 
-       #[derive(Eq, PartialEq, Debug)]
+       #[derive(Clone, Eq, PartialEq, Debug)]
        struct TestCustomMessage {}
 
        const CUSTOM_MESSAGE_TYPE : u16 = 9000;