Skip to content

Commit c1c21a1

Browse files
committed
derive(Clone) for several pub simple data structs.
There is no reason not to and Clone can be useful especially in the bindings context.
1 parent eb02472 commit c1c21a1

File tree

6 files changed

+8
-2
lines changed

6 files changed

+8
-2
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub enum ChannelMonitorUpdateErr {
164164
pub struct MonitorUpdateError(pub &'static str);
165165

166166
/// An event to be processed by the ChannelManager.
167-
#[derive(PartialEq)]
167+
#[derive(Clone, PartialEq)]
168168
pub enum MonitorEvent {
169169
/// A monitor event containing an HTLCUpdate.
170170
HTLCEvent(HTLCUpdate),

lightning/src/ln/chan_utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ impl_writeable!(TxCreationKeys, 33*6,
318318
/// in the signer.
319319
/// The pre-calculated keys are an optimization, because ChannelKeys has enough
320320
/// information to re-derive them.
321+
#[derive(PartialEq, Clone)]
321322
pub struct PreCalculatedTxCreationKeys(TxCreationKeys);
322323

323324
impl PreCalculatedTxCreationKeys {

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ const CHECK_CLTV_EXPIRY_SANITY: u32 = CLTV_EXPIRY_DELTA as u32 - LATENCY_GRACE_P
464464
#[allow(dead_code)]
465465
const CHECK_CLTV_EXPIRY_SANITY_2: u32 = CLTV_EXPIRY_DELTA as u32 - LATENCY_GRACE_PERIOD_BLOCKS - 2*CLTV_CLAIM_BUFFER;
466466

467+
#[derive(Clone)]
467468
/// Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
468469
pub struct ChannelDetails {
469470
/// The channel's ID (prior to funding transaction generation, this is a random 32 bytes,

lightning/src/ln/msgs.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ pub enum DecodeError {
6464
}
6565

6666
/// An init message to be sent or received from a peer
67+
#[derive(Clone)]
6768
pub struct Init {
6869
#[cfg(not(feature = "fuzztarget"))]
6970
pub(crate) features: InitFeatures,
@@ -84,6 +85,7 @@ pub struct ErrorMessage {
8485
}
8586

8687
/// A ping message to be sent or received from a peer
88+
#[derive(Clone)]
8789
pub struct Ping {
8890
/// The desired response length
8991
pub ponglen: u16,
@@ -93,6 +95,7 @@ pub struct Ping {
9395
}
9496

9597
/// A pong message to be sent or received from a peer
98+
#[derive(Clone)]
9699
pub struct Pong {
97100
/// The pong packet size.
98101
/// This field is not sent on the wire. byteslen zeros are sent.

lightning/src/routing/router.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ impl Readable for Route {
112112
}
113113
}
114114

115+
#[derive(Clone)]
115116
/// A channel descriptor which provides a last-hop route to get_route
116117
pub struct RouteHint {
117118
/// The node_id of the non-target end of the route

lightning/src/util/events.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use std::time::Duration;
3131
/// Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
3232
/// them directly as they don't round-trip exactly (for example FundingGenerationReady is never
3333
/// written as it makes no sense to respond to it after reconnecting to peers).
34-
#[derive(Debug)]
34+
#[derive(Clone, Debug)]
3535
pub enum Event {
3636
/// Used to indicate that the client should generate a funding transaction with the given
3737
/// parameters and then call ChannelManager::funding_transaction_generated.

0 commit comments

Comments
 (0)