mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-07-30 20:11:23 +00:00
Block header representation
This commit is contained in:
32
zcash_primitives/src/block.rs
Normal file
32
zcash_primitives/src/block.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
use std::ops::Deref;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct BlockHash(pub [u8; 32]);
|
||||
|
||||
/// A Zcash block header.
|
||||
pub struct BlockHeader(BlockHeaderData);
|
||||
|
||||
impl Deref for BlockHeader {
|
||||
type Target = BlockHeaderData;
|
||||
|
||||
fn deref(&self) -> &BlockHeaderData {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BlockHeaderData {
|
||||
pub version: i32,
|
||||
pub prev_block: BlockHash,
|
||||
pub merkle_root: [u8; 32],
|
||||
pub final_sapling_root: [u8; 32],
|
||||
pub time: u32,
|
||||
pub bits: u32,
|
||||
pub nonce: [u8; 32],
|
||||
pub solution: Vec<u8>,
|
||||
}
|
||||
|
||||
impl BlockHeaderData {
|
||||
pub fn freeze(self) -> BlockHeader {
|
||||
BlockHeader(self)
|
||||
}
|
||||
}
|
@@ -10,6 +10,7 @@ extern crate sapling_crypto;
|
||||
|
||||
use sapling_crypto::jubjub::JubjubBls12;
|
||||
|
||||
pub mod block;
|
||||
pub mod sapling;
|
||||
mod serialize;
|
||||
pub mod transaction;
|
||||
|
Reference in New Issue
Block a user