Struct grin_core::core::block::BlockHeader [−][src]
pub struct BlockHeader { pub version: HeaderVersion, pub height: u64, pub prev_hash: Hash, pub prev_root: Hash, pub timestamp: DateTime<Utc>, pub output_root: Hash, pub range_proof_root: Hash, pub kernel_root: Hash, pub total_kernel_offset: BlindingFactor, pub output_mmr_size: u64, pub kernel_mmr_size: u64, pub pow: ProofOfWork, }
Block header, fairly standard compared to other blockchains.
Fields
version: HeaderVersion
Version of the block
height: u64
Height of this block since the genesis block (height 0)
prev_hash: Hash
Hash of the block previous to this in the chain.
prev_root: Hash
Root hash of the header MMR at the previous header.
timestamp: DateTime<Utc>
Timestamp at which the block was built.
output_root: Hash
Merklish root of all the commitments in the TxHashSet
range_proof_root: Hash
Merklish root of all range proofs in the TxHashSet
kernel_root: Hash
Merklish root of all transaction kernels in the TxHashSet
total_kernel_offset: BlindingFactor
Total accumulated sum of kernel offsets since genesis block. We can derive the kernel offset sum for this block from the total kernel offset of the previous block header.
output_mmr_size: u64
Total size of the output MMR after applying this block
kernel_mmr_size: u64
Total size of the kernel MMR after applying this block
pow: ProofOfWork
Proof of work and related
Implementations
impl BlockHeader
[src]
impl BlockHeader
[src]pub fn write_pre_pow<W: Writer>(&self, writer: &mut W) -> Result<(), Error>
[src]
pub fn write_pre_pow<W: Writer>(&self, writer: &mut W) -> Result<(), Error>
[src]Write the pre-hash portion of the header
pub fn pre_pow(&self) -> Vec<u8>
[src]
pub fn pre_pow(&self) -> Vec<u8>
[src]Return the pre-pow, unhashed Let the cuck(at)oo miner/verifier handle the hashing for consistency with how this call is performed everywhere else
pub fn from_pre_pow_and_proof(
pre_pow: String,
nonce: u64,
proof: Proof
) -> Result<Self, Error>
[src]
pub fn from_pre_pow_and_proof(
pre_pow: String,
nonce: u64,
proof: Proof
) -> Result<Self, Error>
[src]Constructs a header given pre_pow string, nonce, and proof
pub fn output_mmr_count(&self) -> u64
[src]
pub fn output_mmr_count(&self) -> u64
[src]Total number of outputs (spent and unspent) based on output MMR size committed to in this block. Note: Not the number of outputs in this block but total up to and including this block. The MMR size is the total number of hashes contained in the full MMR structure. We want the corresponding number of leaves in the MMR given the size.
pub fn kernel_mmr_count(&self) -> u64
[src]
pub fn kernel_mmr_count(&self) -> u64
[src]Total number of kernels based on kernel MMR size committed to in this block. Note: Not the number of kernels in this block but total up to and including this block. The MMR size is the total number of hashes contained in the full MMR structure. We want the corresponding number of leaves in the MMR given the size.
pub fn total_difficulty(&self) -> Difficulty
[src]
pub fn total_difficulty(&self) -> Difficulty
[src]Total difficulty accumulated by the proof of work on this header
pub fn overage(&self) -> i64
[src]
pub fn overage(&self) -> i64
[src]The “overage” to use when verifying the kernel sums. For a block header the overage is 0 - reward.
pub fn total_overage(&self, genesis_had_reward: bool) -> i64
[src]
pub fn total_overage(&self, genesis_had_reward: bool) -> i64
[src]The “total overage” to use when verifying the kernel sums for a full chain state. For a full chain state this is 0 - (height * reward).
pub fn total_kernel_offset(&self) -> BlindingFactor
[src]
pub fn total_kernel_offset(&self) -> BlindingFactor
[src]Total kernel offset for the chain state up to and including this block.
Trait Implementations
impl Clone for BlockHeader
[src]
impl Clone for BlockHeader
[src]fn clone(&self) -> BlockHeader
[src]
fn clone(&self) -> BlockHeader
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for BlockHeader
[src]
impl Debug for BlockHeader
[src]impl Default for BlockHeader
[src]
impl Default for BlockHeader
[src]fn default() -> BlockHeader
[src]
fn default() -> BlockHeader
[src]Returns the “default value” for a type. Read more
impl From<UntrustedBlockHeader> for BlockHeader
[src]
impl From<UntrustedBlockHeader> for BlockHeader
[src]fn from(header: UntrustedBlockHeader) -> Self
[src]
fn from(header: UntrustedBlockHeader) -> Self
[src]Performs the conversion.
impl PMMRable for BlockHeader
[src]
impl PMMRable for BlockHeader
[src]impl PartialEq<BlockHeader> for BlockHeader
[src]
impl PartialEq<BlockHeader> for BlockHeader
[src]fn eq(&self, other: &BlockHeader) -> bool
[src]
fn eq(&self, other: &BlockHeader) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &BlockHeader) -> bool
[src]
fn ne(&self, other: &BlockHeader) -> bool
[src]This method tests for !=
.
impl Readable for BlockHeader
[src]
impl Readable for BlockHeader
[src]Deserialization of a block header
impl Serialize for BlockHeader
[src]
impl Serialize for BlockHeader
[src]impl Writeable for BlockHeader
[src]
impl Writeable for BlockHeader
[src]Serialization of a block header
impl DefaultHashable for BlockHeader
[src]
impl StructuralPartialEq for BlockHeader
[src]
Auto Trait Implementations
impl RefUnwindSafe for BlockHeader
impl Send for BlockHeader
impl Sync for BlockHeader
impl Unpin for BlockHeader
impl UnwindSafe for BlockHeader
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> CloneAny for T where
T: Any + Clone,
impl<T> CloneAny for T where
T: Any + Clone,
pub fn clone_any(&self) -> Box<dyn CloneAny + 'static, Global>
pub fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send, Global> where
T: Send,
T: Send,
pub fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync, Global> where
T: Sync,
T: Sync,
pub fn clone_any_send_sync(
&self
) -> Box<dyn CloneAny + 'static + Sync + Send, Global> where
T: Send + Sync,
&self
) -> Box<dyn CloneAny + 'static + Sync + Send, Global> where
T: Send + Sync,
impl<D> Hashed for D where
D: DefaultHashable,
[src]
impl<D> Hashed for D where
D: DefaultHashable,
[src]impl<T> PMMRIndexHashable for T where
T: DefaultHashable,
[src]
impl<T> PMMRIndexHashable for T where
T: DefaultHashable,
[src]pub fn hash_with_index(&Self, u64) -> Hash
[src]
pub fn hash_with_index(&Self, u64) -> Hash
[src]Hash with a given index
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<H> ShortIdentifiable for H where
H: Hashed,
[src]
impl<H> ShortIdentifiable for H where
H: Hashed,
[src]pub fn short_id(&Self, &Hash, u64) -> ShortId
[src]
pub fn short_id(&Self, &Hash, u64) -> ShortId
[src]Generate a short_id via the following -
- extract k0/k1 from block_hash hashed with the nonce (first two u64
values) * initialize a siphasher24 with k0/k1
- self.hash() passing in the siphasher24 instance
- drop the 2 most significant bytes (to return a 6 byte short_id)
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> DebugAny for T where
T: Any + Debug,
T: Any + Debug,
impl<T> UnsafeAny for T where
T: Any,
T: Any,