Block header representation
This commit is contained in:
parent
e4187f07ff
commit
e21be37042
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue