Skip to content

Commit

Permalink
Standardize and cleanup SerializationMode (mimblewimble#856)
Browse files Browse the repository at this point in the history
  • Loading branch information
antiochp authored and dpc committed Oct 24, 2018
1 parent e3ee7d7 commit 782440e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
7 changes: 3 additions & 4 deletions core/src/core/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,11 @@ impl Default for BlockHeader {
/// Serialization of a block header
impl Writeable for BlockHeader {
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), ser::Error> {
if writer.serialization_mode() == ser::SerializationMode::Hash {
try!(self.pow.write(writer));
} else {
if writer.serialization_mode() != ser::SerializationMode::Hash {
self.write_pre_pow(writer)?;
self.pow.write(writer)?;
}

self.pow.write(writer)?;
Ok(())
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/core/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ impl Writeable for Output {
self.commit.write(writer)?;
// The hash of an output doesn't include the range proof, which
// is commit to separately
if writer.serialization_mode() == ser::SerializationMode::Full {
if writer.serialization_mode() != ser::SerializationMode::Hash {
writer.write_bytes(&self.proof)?
}
Ok(())
Expand Down
5 changes: 0 additions & 5 deletions core/src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ pub enum SerializationMode {
Full,
/// Serialize the data that defines the object
Hash,
/// Serialize everything that a signer of the object should know
SigHash,
/// Serialize for local storage, for instance in the case where
/// an output doesn't wish to store its range proof
Storage,
}

/// Implementations defined how different numbers and binary structures are
Expand Down

0 comments on commit 782440e

Please sign in to comment.