derive(Clone) for several pub simple data structs.
authorMatt Corallo <git@bluematt.me>
Tue, 20 Oct 2020 18:01:22 +0000 (14:01 -0400)
committerMatt Corallo <git@bluematt.me>
Mon, 23 Nov 2020 16:08:34 +0000 (11:08 -0500)
There is no reason not to and Clone can be useful especially in the
bindings context.

lightning/src/chain/channelmonitor.rs
lightning/src/ln/chan_utils.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/msgs.rs
lightning/src/routing/router.rs
lightning/src/util/events.rs

index bb8d8c32de483215aee393202b7f9a74e4e29cb6..c3382caaea4f8f199b4bf40843788db682c5e6bf 100644 (file)
@@ -179,7 +179,7 @@ pub enum ChannelMonitorUpdateErr {
 pub struct MonitorUpdateError(pub &'static str);
 
 /// An event to be processed by the ChannelManager.
-#[derive(PartialEq)]
+#[derive(Clone, PartialEq)]
 pub enum MonitorEvent {
        /// A monitor event containing an HTLCUpdate.
        HTLCEvent(HTLCUpdate),
index 540155a3afbbe9bcbda72fd5d5208887354e3e0b..7b7d511d653e0553e2fb41d44cd97c2a31adf445 100644 (file)
@@ -318,6 +318,7 @@ impl_writeable!(TxCreationKeys, 33*6,
 /// in the signer.
 /// The pre-calculated keys are an optimization, because ChannelKeys has enough
 /// information to re-derive them.
+#[derive(PartialEq, Clone)]
 pub struct PreCalculatedTxCreationKeys(TxCreationKeys);
 
 impl PreCalculatedTxCreationKeys {
index a884b5f72d870a173f2d27986522ce2394f136ad..d47eba0539bf3438b21c70447d77aee3bf6a2200 100644 (file)
@@ -475,6 +475,7 @@ const CHECK_CLTV_EXPIRY_SANITY: u32 = CLTV_EXPIRY_DELTA as u32 - LATENCY_GRACE_P
 const CHECK_CLTV_EXPIRY_SANITY_2: u32 = CLTV_EXPIRY_DELTA as u32 - LATENCY_GRACE_PERIOD_BLOCKS - 2*CLTV_CLAIM_BUFFER;
 
 /// Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
+#[derive(Clone)]
 pub struct ChannelDetails {
        /// The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
        /// thereafter this is the txid of the funding transaction xor the funding transaction output).
index 16ba08629fe66bab2cfe0f2d4b2b036e981d4234..f57cf0fd1fb9304fac06f34fad5164e6e8a1dfe4 100644 (file)
@@ -64,6 +64,7 @@ pub enum DecodeError {
 }
 
 /// An init message to be sent or received from a peer
+#[derive(Clone)]
 pub struct Init {
        #[cfg(not(feature = "fuzztarget"))]
        pub(crate) features: InitFeatures,
@@ -84,6 +85,7 @@ pub struct ErrorMessage {
 }
 
 /// A ping message to be sent or received from a peer
+#[derive(Clone)]
 pub struct Ping {
        /// The desired response length
        pub ponglen: u16,
@@ -93,6 +95,7 @@ pub struct Ping {
 }
 
 /// A pong message to be sent or received from a peer
+#[derive(Clone)]
 pub struct Pong {
        /// The pong packet size.
        /// This field is not sent on the wire. byteslen zeros are sent.
index 56beb2ea05f922377b9eba6f855d5577001a7251..64a08e732ecbd6e032a154eacb46133fadc882a9 100644 (file)
@@ -113,6 +113,7 @@ impl Readable for Route {
 }
 
 /// A channel descriptor which provides a last-hop route to get_route
+#[derive(Clone)]
 pub struct RouteHint {
        /// The node_id of the non-target end of the route
        pub src_node_id: PublicKey,
index 60191b886d59222bf7b2310e2f80264942cce70c..3eeacdc732cb12969f0cddd69aa329745dce5297 100644 (file)
@@ -31,7 +31,7 @@ use std::time::Duration;
 /// Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
 /// them directly as they don't round-trip exactly (for example FundingGenerationReady is never
 /// written as it makes no sense to respond to it after reconnecting to peers).
-#[derive(Debug)]
+#[derive(Clone, Debug)]
 pub enum Event {
        /// Used to indicate that the client should generate a funding transaction with the given
        /// parameters and then call ChannelManager::funding_transaction_generated.