X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fmsgs.rs;h=0042cf51bf3c2c570c5f1f007567b317230fc54a;hb=0dfcacd22c23f69b6526c9c6507d21427a2b7ccb;hp=fa3c6034e49deefe405bd8dc279ceccaa76f06a5;hpb=e75d41be7a22e4d9477c52842b8adff8983eeafb;p=rust-lightning diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index fa3c6034..0042cf51 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -35,7 +35,8 @@ use ln::features::{ChannelFeatures, InitFeatures, NodeFeatures}; use prelude::*; use core::{cmp, fmt}; use core::fmt::Debug; -use std::io::Read; +use io::{self, Read}; +use io_extras::read_to_end; use util::events::MessageSendEventsProvider; use util::logger; @@ -64,7 +65,7 @@ pub enum DecodeError { BadLengthDescriptor, /// Error from std::io Io(/// (C-not exported) as ErrorKind doesn't have a reasonable mapping - ::std::io::ErrorKind), + io::ErrorKind), /// The message included zlib-compressed values, which we don't support. UnsupportedCompression, } @@ -420,7 +421,7 @@ impl NetAddress { } impl Writeable for NetAddress { - fn write(&self, writer: &mut W) -> Result<(), ::std::io::Error> { + fn write(&self, writer: &mut W) -> Result<(), io::Error> { match self { &NetAddress::IPv4 { ref addr, ref port } => { 1u8.write(writer)?; @@ -885,7 +886,7 @@ pub trait RoutingMessageHandler : MessageSendEventsProvider { mod fuzzy_internal_msgs { use prelude::*; - use ln::PaymentSecret; + use ln::{PaymentPreimage, PaymentSecret}; // These types aren't intended to be pub, but are exposed for direct fuzzing (as we deserialize // them from untrusted input): @@ -906,6 +907,7 @@ mod fuzzy_internal_msgs { }, FinalNode { payment_data: Option, + keysend_preimage: Option, }, } @@ -978,9 +980,9 @@ impl fmt::Display for DecodeError { } } -impl From<::std::io::Error> for DecodeError { - fn from(e: ::std::io::Error) -> Self { - if e.kind() == ::std::io::ErrorKind::UnexpectedEof { +impl From for DecodeError { + fn from(e: io::Error) -> Self { + if e.kind() == io::ErrorKind::UnexpectedEof { DecodeError::ShortRead } else { DecodeError::Io(e.kind()) @@ -989,7 +991,7 @@ impl From<::std::io::Error> for DecodeError { } impl Writeable for OptionalField