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).
The authorized inner SNARK IDs.
Implementations
impl ConsensusParameters
[src]
pub fn get_block_difficulty(
&self,
prev_header: &BlockHeader,
block_timestamp: i64
) -> u64
[src]
&self,
prev_header: &BlockHeader,
block_timestamp: i64
) -> u64
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]
&self,
header: &BlockHeader,
parent_header: &BlockHeader,
merkle_root_hash: &MerkleRootHash,
pedersen_merkle_root_hash: &PedersenMerkleRootHash
) -> Result<(), ConsensusError>
Verify all fields in a block header.
- The parent hash points to the tip of the chain.
- Transactions hash to merkle root.
- The timestamp is less than 2 hours into the future.
- The timestamp is greater than parent timestamp.
- The header is greater than or equal to target difficulty.
- 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]
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>
Generate the birth and death program proofs for a transaction for a given transaction kernel
Trait Implementations
impl Clone for ConsensusParameters
[src]
fn clone(&self) -> ConsensusParameters
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ConsensusParameters
[src]
Auto Trait Implementations
impl RefUnwindSafe for ConsensusParameters
impl Send for ConsensusParameters
impl Sync for ConsensusParameters
impl Unpin for ConsensusParameters
impl UnwindSafe for ConsensusParameters
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,