X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Futil%2Fser.rs;h=92cc66b81e30af9599f35bcd8cec1bcb088d2713;hb=a610e275c63a914e60d02d85499c9291d2cf8084;hp=18e558204963984ebef1f929883c1f7f852f14e3;hpb=c91f72c131e8390ec86ace9cc4c70a55cf5f9438;p=rust-lightning diff --git a/src/util/ser.rs b/src/util/ser.rs index 18e55820..92cc66b8 100644 --- a/src/util/ser.rs +++ b/src/util/ser.rs @@ -1,3 +1,6 @@ +//! A very simple serialization framework which is used to serialize/deserialize messages as well +//! as ChannelsManagers and ChannelMonitors. + use std::result::Result; use std::io::Read; use std::collections::HashMap; @@ -292,7 +295,7 @@ impl Readable for PublicKey { let buf: [u8; 33] = Readable::read(r)?; match PublicKey::from_slice(&Secp256k1::without_caps(), &buf) { Ok(key) => Ok(key), - Err(_) => return Err(DecodeError::BadPublicKey), + Err(_) => return Err(DecodeError::InvalidValue), } } } @@ -321,7 +324,7 @@ impl Readable for Signature { let buf: [u8; 64] = Readable::read(r)?; match Signature::from_compact(&Secp256k1::without_caps(), &buf) { Ok(sig) => Ok(sig), - Err(_) => return Err(DecodeError::BadSignature), + Err(_) => return Err(DecodeError::InvalidValue), } } }