Struct zcash_history::NodeData

source ·
#[repr(C)]
pub struct NodeData { pub consensus_branch_id: u32, pub subtree_commitment: [u8; 32], pub start_time: u32, pub end_time: u32, pub start_target: u32, pub end_target: u32, pub start_sapling_root: [u8; 32], pub end_sapling_root: [u8; 32], pub subtree_total_work: U256, pub start_height: u64, pub end_height: u64, pub sapling_tx: u64, }
Expand description

V1 node metadata.

Fields§

§consensus_branch_id: u32

Consensus branch id, should be provided by deserializing node.

§subtree_commitment: [u8; 32]

Subtree commitment - either block hash for leaves or hashsum of children for nodes.

§start_time: u32

Start time.

§end_time: u32

End time.

§start_target: u32

Start target.

§end_target: u32

End target.

§start_sapling_root: [u8; 32]

Start sapling tree root.

§end_sapling_root: [u8; 32]

End sapling tree root.

§subtree_total_work: U256

Part of tree total work.

§start_height: u64

Start height.

§end_height: u64

End height

§sapling_tx: u64

Number of Sapling transactions.

Implementations§

source§

impl NodeData

source

pub fn combine(left: &NodeData, right: &NodeData) -> NodeData

Combine two nodes metadata.

source

pub fn write<W: Write>(&self, w: &mut W) -> Result<()>

Write to the byte representation.

source

pub fn read<R: Read>(consensus_branch_id: u32, r: &mut R) -> Result<Self>

Read from the byte representation.

source

pub fn to_bytes(&self) -> Vec<u8>

Convert to byte representation.

source

pub fn from_bytes<T: AsRef<[u8]>>( consensus_branch_id: u32, buf: T ) -> Result<Self>

Convert from byte representation.

source

pub fn hash(&self) -> [u8; 32]

Hash node metadata

Trait Implementations§

source§

impl Clone for NodeData

source§

fn clone(&self) -> NodeData

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for NodeData

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for NodeData

source§

fn default() -> NodeData

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.