Skip to content

Commit

Permalink
fix header consensus
Browse files Browse the repository at this point in the history
  • Loading branch information
SWvheerden committed Aug 23, 2022
1 parent 1885509 commit 491d588
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions base_layer/common_types/src/types/fixed_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ impl FixedHash {
pub fn as_slice(&self) -> &[u8] {
&self.0
}

pub fn as_fixed_slice(&self) -> &[u8; FixedHash::byte_size()] {
&self.0
}
}

impl From<[u8; FixedHash::byte_size()]> for FixedHash {
Expand Down
8 changes: 4 additions & 4 deletions base_layer/core/src/blocks/block_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,12 @@ impl ConsensusEncoding for BlockHeader {
self.height.consensus_encode(writer)?;
copy_into_fixed_array_lossy::<_, 32>(&self.prev_hash).consensus_encode(writer)?;
self.timestamp.consensus_encode(writer)?;
self.output_mr.as_slice().consensus_encode(writer)?;
self.witness_mr.as_slice().consensus_encode(writer)?;
self.output_mr.as_fixed_slice().consensus_encode(writer)?;
self.witness_mr.as_fixed_slice().consensus_encode(writer)?;
self.output_mmr_size.consensus_encode(writer)?;
self.kernel_mr.as_slice().consensus_encode(writer)?;
self.kernel_mr.as_fixed_slice().consensus_encode(writer)?;
self.kernel_mmr_size.consensus_encode(writer)?;
self.input_mr.as_slice().consensus_encode(writer)?;
self.input_mr.as_fixed_slice().consensus_encode(writer)?;
self.total_kernel_offset.consensus_encode(writer)?;
self.total_script_offset.consensus_encode(writer)?;
self.nonce.consensus_encode(writer)?;
Expand Down

0 comments on commit 491d588

Please sign in to comment.