mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-11-02 20:37:03 +00:00
Add prevHash field to CompactBlock
This enables basic verification of chain validity when CompactBlocks are received without the full header.
This commit is contained in:
@@ -22,6 +22,20 @@ impl fmt::Display for BlockHash {
|
||||
}
|
||||
}
|
||||
|
||||
impl BlockHash {
|
||||
/// Constructs a [`BlockHash`] from the given slice.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// This function will panic if the slice is not exactly 32 bytes.
|
||||
pub fn from_slice(bytes: &[u8]) -> Self {
|
||||
assert_eq!(bytes.len(), 32);
|
||||
let mut hash = [0; 32];
|
||||
hash.copy_from_slice(&bytes);
|
||||
BlockHash(hash)
|
||||
}
|
||||
}
|
||||
|
||||
/// A Zcash block header.
|
||||
pub struct BlockHeader {
|
||||
hash: BlockHash,
|
||||
|
||||
Reference in New Issue
Block a user