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())
}
}
}