Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: header consensus #4527

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)?;
SWvheerden marked this conversation as resolved.
Show resolved Hide resolved
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