X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Fser.rs;h=b718e228c93e8233ce799e7fa10c90b26cd89b9d;hb=c21b866c6088b4171e798cdad286df06906b8388;hp=581f228ba7574323180cf662581425e301d74aab;hpb=2de29ae04946801f0382cf85f15cbf90105ca4f8;p=rust-lightning diff --git a/lightning/src/util/ser.rs b/lightning/src/util/ser.rs index 581f228b..b718e228 100644 --- a/lightning/src/util/ser.rs +++ b/lightning/src/util/ser.rs @@ -707,8 +707,7 @@ macro_rules! impl_consensus_ser { fn write(&self, writer: &mut W) -> Result<(), ::std::io::Error> { match self.consensus_encode(WriterWriteAdaptor(writer)) { Ok(_) => Ok(()), - Err(consensus::encode::Error::Io(e)) => Err(e), - Err(_) => panic!("We shouldn't get a consensus::encode::Error unless our Write generated an std::io::Error"), + Err(e) => Err(e), } } } @@ -718,7 +717,7 @@ macro_rules! impl_consensus_ser { 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), } }