msgs::DecodeError::InvalidValue => return,
msgs::DecodeError::BadLengthDescriptor => return,
msgs::DecodeError::ShortRead => panic!("We picked the length..."),
- msgs::DecodeError::Io(e) => panic!(format!("{}", e)),
+ msgs::DecodeError::Io(e) => panic!(format!("{:?}", e)),
}
}
}}
/// means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
/// corrupted.
/// Contains a developer-readable error message.
-#[derive(Debug)]
+#[derive(Clone, Debug)]
pub struct MonitorUpdateError(pub &'static str);
/// An event to be processed by the ChannelManager.
/// If a payment fails to send, it can be in one of several states. This enum is returned as the
/// Err() type describing which state the payment is in, see the description of individual enum
/// states for more.
-#[derive(Debug)]
+#[derive(Clone, Debug)]
pub enum PaymentSendFailure {
/// A parameter which was passed to send_payment was invalid, preventing us from attempting to
/// send the payment at all. No channel state has been changed or messages sent to peers, and
use ln::features::{ChannelFeatures, InitFeatures, NodeFeatures};
use std::{cmp, fmt};
+use std::fmt::Debug;
use std::io::Read;
use util::events::MessageSendEventsProvider;
pub(crate) const MAX_VALUE_MSAT: u64 = 21_000_000_0000_0000_000;
/// An error in decoding a message or struct.
-#[derive(Debug)]
+#[derive(Clone, Debug)]
pub enum DecodeError {
/// A version byte specified something we don't know how to handle.
/// Includes unknown realm byte in an OnionHopData packet
/// A length descriptor in the packet didn't describe the later data correctly
BadLengthDescriptor,
/// Error from std::io
- Io(::std::io::Error),
+ Io(::std::io::ErrorKind),
}
/// An init message to be sent or received from a peer
}
/// An Err type for failure to process messages.
+#[derive(Clone)]
pub struct LightningError {
/// A human-readable message describing the error
pub err: String,
if e.kind() == ::std::io::ErrorKind::UnexpectedEof {
DecodeError::ShortRead
} else {
- DecodeError::Io(e)
+ DecodeError::Io(e.kind())
}
}
}
/// Error for PeerManager errors. If you get one of these, you must disconnect the socket and
/// generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
/// descriptor.
+#[derive(Clone)]
pub struct PeerHandleError {
/// Used to indicate that we probably can't make any future connections to this peer, implying
/// we should go ahead and force-close any channels we have with it.
}
}
-#[derive(PartialEq, Debug)]
+#[derive(Clone, PartialEq, Debug)]
/// Details about one direction of a channel. Received
/// within a channel update.
pub struct DirectionalChannelInfo {
}
}
-#[derive(PartialEq, Debug)]
+#[derive(Clone, PartialEq, Debug)]
/// Information received in the latest node_announcement from this node.
pub struct NodeAnnouncementInfo {
/// Protocol features the node announced support for
}
}
-#[derive(PartialEq)]
+#[derive(Clone, PartialEq)]
/// Details about a node in the network, known from the network announcement.
pub struct NodeInfo {
/// All valid channels a node has announced
/// Indicates an error on the client's part (usually some variant of attempting to use too-low or
/// too-high values)
+#[derive(Clone)]
pub enum APIError {
/// Indicates the API was wholly misused (see err for more). Cases where these can be returned
/// are documented, but generally indicates some precondition of a function was violated.
match consensus::encode::Decodable::consensus_decode(r) {
Ok(t) => Ok(t),
Err(consensus::encode::Error::Io(ref e)) if e.kind() == ::std::io::ErrorKind::UnexpectedEof => Err(DecodeError::ShortRead),
- Err(consensus::encode::Error::Io(e)) => Err(DecodeError::Io(e)),
+ Err(consensus::encode::Error::Io(e)) => Err(DecodeError::Io(e.kind())),
Err(_) => Err(DecodeError::InvalidValue),
}
}