Struct snarkos_consensus::consensus::Consensus [−][src]
pub struct Consensus<S: Storage> { pub parameters: ConsensusParameters, pub public_parameters: PublicParameters<Components>, pub ledger: Arc<MerkleTreeLedger<S>>, pub memory_pool: Mutex<MemoryPool<Tx>>, }
Fields
parameters: ConsensusParameters
public_parameters: PublicParameters<Components>
ledger: Arc<MerkleTreeLedger<S>>
memory_pool: Mutex<MemoryPool<Tx>>
Implementations
impl<S: Storage> Consensus<S>
[src]
pub fn verify_transaction(
&self,
transaction: &Tx
) -> Result<bool, ConsensusError>
[src]
&self,
transaction: &Tx
) -> Result<bool, ConsensusError>
Check if the transaction is valid.
pub fn verify_transactions(
&self,
transactions: &[Tx]
) -> Result<bool, ConsensusError>
[src]
&self,
transactions: &[Tx]
) -> Result<bool, ConsensusError>
Check if the transactions are valid.
pub fn verify_block(&self, block: &Block<Tx>) -> Result<bool, ConsensusError>
[src]
Check if the block is valid. Verify transactions and transaction fees.
pub fn receive_block(&self, block: &Block<Tx>) -> Result<(), ConsensusError>
[src]
Receive a block from an external source and process it based on ledger state.
pub fn process_block(&self, block: &Block<Tx>) -> Result<(), ConsensusError>
[src]
Return whether or not the given block is valid and insert it.
- Verify that the block header is valid.
- Verify that the transactions are valid.
- Insert/canonize block.
pub fn create_transaction<R: Rng>(
&self,
old_records: Vec<DPCRecord<Components>>,
old_account_private_keys: Vec<AccountPrivateKey<Components>>,
new_record_owners: Vec<AccountAddress<Components>>,
new_birth_program_ids: Vec<Vec<u8>>,
new_death_program_ids: Vec<Vec<u8>>,
new_is_dummy_flags: Vec<bool>,
new_values: Vec<u64>,
new_payloads: Vec<RecordPayload>,
memo: [u8; 32],
rng: &mut R
) -> Result<(Vec<DPCRecord<Components>>, Tx), ConsensusError>
[src]
&self,
old_records: Vec<DPCRecord<Components>>,
old_account_private_keys: Vec<AccountPrivateKey<Components>>,
new_record_owners: Vec<AccountAddress<Components>>,
new_birth_program_ids: Vec<Vec<u8>>,
new_death_program_ids: Vec<Vec<u8>>,
new_is_dummy_flags: Vec<bool>,
new_values: Vec<u64>,
new_payloads: Vec<RecordPayload>,
memo: [u8; 32],
rng: &mut R
) -> Result<(Vec<DPCRecord<Components>>, Tx), ConsensusError>
Generate a transaction by spending old records and specifying new record attributes
pub fn create_coinbase_transaction<R: Rng>(
&self,
block_num: u32,
transactions: &DPCTransactions<Tx>,
program_vk_hash: Vec<u8>,
new_birth_program_ids: Vec<Vec<u8>>,
new_death_program_ids: Vec<Vec<u8>>,
recipient: AccountAddress<Components>,
rng: &mut R
) -> Result<(Vec<DPCRecord<Components>>, Tx), ConsensusError>
[src]
&self,
block_num: u32,
transactions: &DPCTransactions<Tx>,
program_vk_hash: Vec<u8>,
new_birth_program_ids: Vec<Vec<u8>>,
new_death_program_ids: Vec<Vec<u8>>,
recipient: AccountAddress<Components>,
rng: &mut R
) -> Result<(Vec<DPCRecord<Components>>, Tx), ConsensusError>
Generate a coinbase transaction given candidate block transactions
Auto Trait Implementations
impl<S> !RefUnwindSafe for Consensus<S>
impl<S> Send for Consensus<S> where
S: Send + Sync,
S: Send + Sync,
impl<S> Sync for Consensus<S> where
S: Send + Sync,
S: Send + Sync,
impl<S> Unpin for Consensus<S>
impl<S> !UnwindSafe for Consensus<S>
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, 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>,