Fix range proof deser (length issue)

This commit is contained in:
Ignotus Peverell 2018-02-24 23:20:15 +00:00
parent ccf8eb9eeb
commit 3ab616b8be
No known key found for this signature in database
GPG key ID: 99CD25F39F8F8211

View file

@ -37,7 +37,7 @@ use util::secp::constants::{
SECRET_KEY_SIZE,
};
const BULLET_PROOF_SIZE:usize = 674;
const BULLET_PROOF_SIZE: usize = 674;
/// Possible errors deriving from serializing or deserializing.
#[derive(Debug)]
@ -364,13 +364,13 @@ impl Readable for Identifier {
impl Writeable for RangeProof {
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), Error> {
writer.write_fixed_bytes(self)
writer.write_bytes(self)
}
}
impl Readable for RangeProof {
fn read(reader: &mut Reader) -> Result<RangeProof, Error> {
let p = try!(reader.read_limited_vec(BULLET_PROOF_SIZE));
let p = reader.read_limited_vec(BULLET_PROOF_SIZE)?;
let mut a = [0; MAX_PROOF_SIZE];
for i in 0..p.len() {
a[i] = p[i];
@ -384,7 +384,7 @@ impl Readable for RangeProof {
impl PMMRable for RangeProof {
fn len() -> usize {
BULLET_PROOF_SIZE
BULLET_PROOF_SIZE + 8
}
}