mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 11:31:08 +03:00
Fix range proof deser (length issue)
This commit is contained in:
parent
ccf8eb9eeb
commit
3ab616b8be
1 changed files with 4 additions and 4 deletions
|
@ -37,7 +37,7 @@ use util::secp::constants::{
|
||||||
SECRET_KEY_SIZE,
|
SECRET_KEY_SIZE,
|
||||||
};
|
};
|
||||||
|
|
||||||
const BULLET_PROOF_SIZE:usize = 674;
|
const BULLET_PROOF_SIZE: usize = 674;
|
||||||
|
|
||||||
/// Possible errors deriving from serializing or deserializing.
|
/// Possible errors deriving from serializing or deserializing.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -364,13 +364,13 @@ impl Readable for Identifier {
|
||||||
|
|
||||||
impl Writeable for RangeProof {
|
impl Writeable for RangeProof {
|
||||||
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), Error> {
|
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), Error> {
|
||||||
writer.write_fixed_bytes(self)
|
writer.write_bytes(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Readable for RangeProof {
|
impl Readable for RangeProof {
|
||||||
fn read(reader: &mut Reader) -> Result<RangeProof, Error> {
|
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];
|
let mut a = [0; MAX_PROOF_SIZE];
|
||||||
for i in 0..p.len() {
|
for i in 0..p.len() {
|
||||||
a[i] = p[i];
|
a[i] = p[i];
|
||||||
|
@ -384,7 +384,7 @@ impl Readable for RangeProof {
|
||||||
|
|
||||||
impl PMMRable for RangeProof {
|
impl PMMRable for RangeProof {
|
||||||
fn len() -> usize {
|
fn len() -> usize {
|
||||||
BULLET_PROOF_SIZE
|
BULLET_PROOF_SIZE + 8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue