Skip to content

Commit

Permalink
Remove extraneous bytes check on input buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
jordy25519 committed Jul 21, 2020
1 parent 449197a commit ee5213a
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/v0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,20 +215,16 @@ impl Decode for DoughnutV0 {
let mut signature = [0_u8; 64];
input.read(&mut signature)?;

if input.read_byte().is_ok() {
Err(codec::Error::from("Doughnut contains unexpected bytes"))
} else {
Ok(Self {
holder,
issuer,
expiry,
not_before,
signature_version,
payload_version,
domains,
signature: H512::from(signature),
})
}
Ok(Self {
holder,
issuer,
expiry,
not_before,
signature_version,
payload_version,
domains,
signature: H512::from(signature),
})
}
}

Expand Down Expand Up @@ -541,6 +537,8 @@ mod test {
);
}

// TODO: reconcile once https://github.com/cennznet/doughnut-rs/issues/67 is solved
#[ignore]
#[test]
fn decode_error_with_too_many_bytes() {
let doughnut = doughnut_builder!();
Expand Down

0 comments on commit ee5213a

Please sign in to comment.