From: Arik Sosman Date: Fri, 2 Aug 2024 01:21:16 +0000 (-0700) Subject: Use custom consensus read method. X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=6df9c3999323b27def3201f93d270153de173209;p=rust-lightning Use custom consensus read method. --- diff --git a/lightning/src/util/ser.rs b/lightning/src/util/ser.rs index 3978823b1..738d58bc0 100644 --- a/lightning/src/util/ser.rs +++ b/lightning/src/util/ser.rs @@ -14,7 +14,7 @@ //! [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor use crate::prelude::*; -use crate::io::{self, Read, Seek, Take, Write, BufRead}; +use crate::io::{self, Read, Seek, Write}; use crate::io_extras::{copy, sink}; use core::hash::Hash; use crate::sync::{Mutex, RwLock}; @@ -280,7 +280,7 @@ pub trait Readable where Self: Sized { /// Reads a `Self` in from the given [`Read`]. - fn read(reader: &mut R) -> Result; + fn read(reader: &mut R) -> Result; } /// A trait that various LDK types implement allowing them to be read in from a @@ -1271,8 +1271,8 @@ macro_rules! impl_consensus_ser { } impl Readable for $bitcoin_type { - fn read(r: &mut R) -> Result { - match consensus::encode::Decodable::consensus_decode(r) { + fn read(r: &mut R) -> Result { + match consensus::encode::Decodable::consensus_decode_read(r) { Ok(t) => Ok(t), Err(consensus::encode::Error::Io(ref e)) if e.kind() == io::ErrorKind::UnexpectedEof => Err(DecodeError::ShortRead), Err(consensus::encode::Error::Io(e)) => Err(DecodeError::Io(e.kind().into())),