Skip to content

Commit 5f4c31f

Browse files
committed
Add additional Clone derives
1 parent 03a6a24 commit 5f4c31f

File tree

7 files changed

+13
-9
lines changed

7 files changed

+13
-9
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ pub enum ChannelMonitorUpdateErr {
174174
/// means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
175175
/// corrupted.
176176
/// Contains a developer-readable error message.
177-
#[derive(Debug)]
177+
#[derive(Clone, Debug)]
178178
pub struct MonitorUpdateError(pub &'static str);
179179

180180
/// An event to be processed by the ChannelManager.

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ pub struct ChannelDetails {
514514
/// If a payment fails to send, it can be in one of several states. This enum is returned as the
515515
/// Err() type describing which state the payment is in, see the description of individual enum
516516
/// states for more.
517-
#[derive(Debug)]
517+
#[derive(Clone, Debug)]
518518
pub enum PaymentSendFailure {
519519
/// A parameter which was passed to send_payment was invalid, preventing us from attempting to
520520
/// send the payment at all. No channel state has been changed or messages sent to peers, and

lightning/src/ln/msgs.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use bitcoin::hash_types::{Txid, BlockHash};
3333
use ln::features::{ChannelFeatures, InitFeatures, NodeFeatures};
3434

3535
use std::{cmp, fmt};
36+
use std::fmt::Debug;
3637
use std::io::Read;
3738

3839
use util::events::MessageSendEventsProvider;
@@ -44,7 +45,7 @@ use ln::channelmanager::{PaymentPreimage, PaymentHash, PaymentSecret};
4445
pub(crate) const MAX_VALUE_MSAT: u64 = 21_000_000_0000_0000_000;
4546

4647
/// An error in decoding a message or struct.
47-
#[derive(Debug)]
48+
#[derive(Clone, Debug)]
4849
pub enum DecodeError {
4950
/// A version byte specified something we don't know how to handle.
5051
/// Includes unknown realm byte in an OnionHopData packet
@@ -60,7 +61,7 @@ pub enum DecodeError {
6061
/// A length descriptor in the packet didn't describe the later data correctly
6162
BadLengthDescriptor,
6263
/// Error from std::io
63-
Io(::std::io::Error),
64+
Io(::std::io::ErrorKind),
6465
}
6566

6667
/// An init message to be sent or received from a peer
@@ -674,6 +675,7 @@ pub enum ErrorAction {
674675
}
675676

676677
/// An Err type for failure to process messages.
678+
#[derive(Clone)]
677679
pub struct LightningError {
678680
/// A human-readable message describing the error
679681
pub err: String,
@@ -949,7 +951,7 @@ impl From<::std::io::Error> for DecodeError {
949951
if e.kind() == ::std::io::ErrorKind::UnexpectedEof {
950952
DecodeError::ShortRead
951953
} else {
952-
DecodeError::Io(e)
954+
DecodeError::Io(e.kind())
953955
}
954956
}
955957
}

lightning/src/ln/peer_handler.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ pub trait SocketDescriptor : cmp::Eq + hash::Hash + Clone {
9090
/// Error for PeerManager errors. If you get one of these, you must disconnect the socket and
9191
/// generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
9292
/// descriptor.
93+
#[derive(Clone)]
9394
pub struct PeerHandleError {
9495
/// Used to indicate that we probably can't make any future connections to this peer, implying
9596
/// we should go ahead and force-close any channels we have with it.

lightning/src/routing/network_graph.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ where
329329
}
330330
}
331331

332-
#[derive(PartialEq, Debug)]
332+
#[derive(Clone, PartialEq, Debug)]
333333
/// Details about one direction of a channel. Received
334334
/// within a channel update.
335335
pub struct DirectionalChannelInfo {
@@ -441,7 +441,7 @@ impl Writeable for RoutingFees {
441441
}
442442
}
443443

444-
#[derive(PartialEq, Debug)]
444+
#[derive(Clone, PartialEq, Debug)]
445445
/// Information received in the latest node_announcement from this node.
446446
pub struct NodeAnnouncementInfo {
447447
/// Protocol features the node announced support for
@@ -507,7 +507,7 @@ impl Readable for NodeAnnouncementInfo {
507507
}
508508
}
509509

510-
#[derive(PartialEq)]
510+
#[derive(Clone, PartialEq)]
511511
/// Details about a node in the network, known from the network announcement.
512512
pub struct NodeInfo {
513513
/// All valid channels a node has announced

lightning/src/util/errors.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::fmt;
1313

1414
/// Indicates an error on the client's part (usually some variant of attempting to use too-low or
1515
/// too-high values)
16+
#[derive(Clone)]
1617
pub enum APIError {
1718
/// Indicates the API was wholly misused (see err for more). Cases where these can be returned
1819
/// are documented, but generally indicates some precondition of a function was violated.

lightning/src/util/ser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ macro_rules! impl_consensus_ser {
718718
match consensus::encode::Decodable::consensus_decode(r) {
719719
Ok(t) => Ok(t),
720720
Err(consensus::encode::Error::Io(ref e)) if e.kind() == ::std::io::ErrorKind::UnexpectedEof => Err(DecodeError::ShortRead),
721-
Err(consensus::encode::Error::Io(e)) => Err(DecodeError::Io(e)),
721+
Err(consensus::encode::Error::Io(e)) => Err(DecodeError::Io(e.kind())),
722722
Err(_) => Err(DecodeError::InvalidValue),
723723
}
724724
}

0 commit comments

Comments
 (0)