Struct snarkos_consensus::parameters::ConsensusParameters[][src]

pub struct ConsensusParameters {
    pub network_id: Network,
    pub max_block_size: usize,
    pub max_nonce: u32,
    pub target_block_time: i64,
    pub verifier: PoswMarlin,
    pub authorized_inner_snark_ids: Vec<Vec<u8>>,
}

A data structure containing the consensus parameters for a specified network on this node.

Fields

network_id: Network

The network ID that these parameters correspond to.

max_block_size: usize

The maximum permitted block size (in bytes).

max_nonce: u32

The maximum permitted nonce value.

target_block_time: i64

The anticipated number of seconds for finding a new block.

verifier: PoswMarlin

The PoSW consensus verifier (read-only mode, no proving key loaded).

authorized_inner_snark_ids: Vec<Vec<u8>>

The authorized inner SNARK IDs.

Implementations

impl ConsensusParameters[src]

pub fn get_block_difficulty(
    &self,
    prev_header: &BlockHeader,
    block_timestamp: i64
) -> u64
[src]

Calculate the difficulty for the next block based off how long it took to mine the last one.

pub fn verify_header(
    &self,
    header: &BlockHeader,
    parent_header: &BlockHeader,
    merkle_root_hash: &MerkleRootHash,
    pedersen_merkle_root_hash: &PedersenMerkleRootHash
) -> Result<(), ConsensusError>
[src]

Verify all fields in a block header.

  1. The parent hash points to the tip of the chain.
  2. Transactions hash to merkle root.
  3. The timestamp is less than 2 hours into the future.
  4. The timestamp is greater than parent timestamp.
  5. The header is greater than or equal to target difficulty.
  6. The nonce is within the limit.

pub fn generate_program_proofs<R: Rng, S: Storage>(
    parameters: &<InstantiatedDPC as DPCScheme<MerkleTreeLedger<S>>>::NetworkParameters,
    transaction_kernel: &<InstantiatedDPC as DPCScheme<MerkleTreeLedger<S>>>::TransactionKernel,
    rng: &mut R
) -> Result<(Vec<<InstantiatedDPC as DPCScheme<MerkleTreeLedger<S>>>::PrivateProgramInput>, Vec<<InstantiatedDPC as DPCScheme<MerkleTreeLedger<S>>>::PrivateProgramInput>), ConsensusError>
[src]

Generate the birth and death program proofs for a transaction for a given transaction kernel

Trait Implementations

impl Clone for ConsensusParameters[src]

impl Debug for ConsensusParameters[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,