pub struct Ledger<N: Network> { /* private fields */ }
Implementations
sourceimpl<N: Network> Ledger<N>
impl<N: Network> Ledger<N>
sourcepub fn latest_block_height(&self) -> u32
pub fn latest_block_height(&self) -> u32
Returns the latest block height.
sourcepub fn latest_block_hash(&self) -> N::BlockHash
pub fn latest_block_hash(&self) -> N::BlockHash
Returns the latest block hash.
sourcepub fn latest_ledger_root(&self) -> N::LedgerRoot
pub fn latest_ledger_root(&self) -> N::LedgerRoot
Returns the latest ledger root.
sourcepub fn latest_block_timestamp(&self) -> Result<i64>
pub fn latest_block_timestamp(&self) -> Result<i64>
Returns the latest block timestamp.
sourcepub fn latest_block_difficulty_target(&self) -> Result<u64>
pub fn latest_block_difficulty_target(&self) -> Result<u64>
Returns the latest block difficulty target.
sourcepub fn latest_cumulative_weight(&self) -> Result<u128>
pub fn latest_cumulative_weight(&self) -> Result<u128>
Returns the latest cumulative weight.
sourcepub fn latest_block_transactions(&self) -> Result<&Transactions<N>>
pub fn latest_block_transactions(&self) -> Result<&Transactions<N>>
Returns the latest block transactions.
sourcepub fn latest_block(&self) -> Result<Block<N>>
pub fn latest_block(&self) -> Result<Block<N>>
Returns the latest block.
sourcepub fn contains_ledger_root(&self, ledger_root: &N::LedgerRoot) -> bool
pub fn contains_ledger_root(&self, ledger_root: &N::LedgerRoot) -> bool
Returns true
if the given ledger root exists on the canon chain.
sourcepub fn contains_block_hash(&self, block_hash: &N::BlockHash) -> bool
pub fn contains_block_hash(&self, block_hash: &N::BlockHash) -> bool
Returns true
if the given block hash exists on the canon chain.
sourcepub fn contains_transaction(&self, transaction: &Transaction<N>) -> bool
pub fn contains_transaction(&self, transaction: &Transaction<N>) -> bool
Returns true
if the given transaction exists on the canon chain.
sourcepub fn add_next_block(&mut self, block: &Block<N>) -> Result<()>
pub fn add_next_block(&mut self, block: &Block<N>) -> Result<()>
Adds the given canon block, if it is well-formed and does not already exist. Note: This method requires blocks to be added in order of canon block height.
sourcepub fn add_orphan_block(&mut self, block: &Block<N>) -> Result<()>
pub fn add_orphan_block(&mut self, block: &Block<N>) -> Result<()>
Adds the given orphan block, if it is well-formed and does not already exist.
sourcepub fn add_unconfirmed_transaction(
&mut self,
transaction: &Transaction<N>
) -> Result<()>
pub fn add_unconfirmed_transaction(
&mut self,
transaction: &Transaction<N>
) -> Result<()>
Adds the given unconfirmed transaction to the memory pool.
sourcepub fn mine_next_block<R: Rng + CryptoRng>(
&mut self,
recipient: Address<N>,
is_public: bool,
terminator: &AtomicBool,
rng: &mut R
) -> Result<Record<N>>
pub fn mine_next_block<R: Rng + CryptoRng>(
&mut self,
recipient: Address<N>,
is_public: bool,
terminator: &AtomicBool,
rng: &mut R
) -> Result<Record<N>>
Mines a new block and adds it to the canon blocks.
sourcepub fn to_ledger_tree(&self) -> &LedgerTree<N>
pub fn to_ledger_tree(&self) -> &LedgerTree<N>
Returns the ledger tree.
sourcepub fn to_ledger_proof(
&self,
commitment: N::Commitment
) -> Result<LedgerProof<N>>
pub fn to_ledger_proof(
&self,
commitment: N::Commitment
) -> Result<LedgerProof<N>>
Returns the ledger proof for the given commitment with the current ledger root.
Trait Implementations
Auto Trait Implementations
impl<N> RefUnwindSafe for Ledger<N> where
N: RefUnwindSafe,
<N as Network>::AccountSignature: RefUnwindSafe,
<N as Network>::BlockHash: RefUnwindSafe,
<N as Network>::BlockHeaderRoot: RefUnwindSafe,
<N as Network>::BlockHeaderRootParameters: RefUnwindSafe,
<N as Network>::Commitment: RefUnwindSafe,
<N as Network>::FunctionID: RefUnwindSafe,
<<N as Network>::InnerCurve as PairingEngine>::G1Affine: RefUnwindSafe,
<N as Network>::InnerCircuitID: RefUnwindSafe,
<N as Network>::InnerCurve: PairingEngine<Fq = <N as Network>::OuterScalarField> + PairingEngine<Fr = <N as Network>::InnerScalarField>,
<N as Network>::InnerScalarField: RefUnwindSafe,
<N as Network>::LedgerRoot: RefUnwindSafe,
<N as Network>::LedgerRootParameters: RefUnwindSafe,
<N as Network>::OuterProof: RefUnwindSafe,
<N as Network>::PoSWNonce: RefUnwindSafe,
<N as Network>::PoSWProof: RefUnwindSafe,
<N as Network>::ProgramAffineCurve: RefUnwindSafe,
<N as Network>::ProgramID: RefUnwindSafe,
<N as Network>::RecordCiphertext: RefUnwindSafe,
<N as Network>::RecordViewKey: RefUnwindSafe,
<N as Network>::SerialNumber: RefUnwindSafe,
<N as Network>::TransactionID: RefUnwindSafe,
<N as Network>::TransactionIDParameters: RefUnwindSafe,
<N as Network>::TransactionsRoot: RefUnwindSafe,
<N as Network>::TransactionsRootParameters: RefUnwindSafe,
<N as Network>::TransitionID: RefUnwindSafe,
<N as Network>::TransitionIDParameters: RefUnwindSafe,
impl<N> Send for Ledger<N> where
<N as Network>::InnerCurve: PairingEngine<Fq = <N as Network>::OuterScalarField> + PairingEngine<Fr = <N as Network>::InnerScalarField>,
impl<N> Sync for Ledger<N> where
<N as Network>::InnerCurve: PairingEngine<Fq = <N as Network>::OuterScalarField> + PairingEngine<Fr = <N as Network>::InnerScalarField>,
impl<N> Unpin for Ledger<N> where
N: Unpin,
<N as Network>::AccountSignature: Unpin,
<N as Network>::BlockHash: Unpin,
<N as Network>::BlockHeaderRoot: Unpin,
<N as Network>::Commitment: Unpin,
<N as Network>::FunctionID: Unpin,
<<N as Network>::InnerCurve as PairingEngine>::G1Affine: Unpin,
<N as Network>::InnerCircuitID: Unpin,
<N as Network>::InnerCurve: PairingEngine<Fq = <N as Network>::OuterScalarField> + PairingEngine<Fr = <N as Network>::InnerScalarField>,
<N as Network>::InnerScalarField: Unpin,
<N as Network>::LedgerRoot: Unpin,
<N as Network>::OuterProof: Unpin,
<N as Network>::PoSWNonce: Unpin,
<N as Network>::PoSWProof: Unpin,
<N as Network>::ProgramAffineCurve: Unpin,
<N as Network>::ProgramID: Unpin,
<N as Network>::RecordCiphertext: Unpin,
<N as Network>::RecordViewKey: Unpin,
<N as Network>::SerialNumber: Unpin,
<N as Network>::TransactionID: Unpin,
<N as Network>::TransactionsRoot: Unpin,
<N as Network>::TransitionID: Unpin,
impl<N> UnwindSafe for Ledger<N> where
N: UnwindSafe,
<N as Network>::AccountSignature: UnwindSafe,
<N as Network>::BlockHash: UnwindSafe,
<N as Network>::BlockHeaderRoot: UnwindSafe,
<N as Network>::BlockHeaderRootParameters: RefUnwindSafe,
<N as Network>::Commitment: UnwindSafe,
<N as Network>::FunctionID: UnwindSafe,
<<N as Network>::InnerCurve as PairingEngine>::G1Affine: UnwindSafe,
<N as Network>::InnerCircuitID: UnwindSafe,
<N as Network>::InnerCurve: PairingEngine<Fq = <N as Network>::OuterScalarField> + PairingEngine<Fr = <N as Network>::InnerScalarField>,
<N as Network>::InnerScalarField: UnwindSafe + RefUnwindSafe,
<N as Network>::LedgerRoot: UnwindSafe,
<N as Network>::LedgerRootParameters: RefUnwindSafe,
<N as Network>::OuterProof: UnwindSafe,
<N as Network>::PoSWNonce: UnwindSafe,
<N as Network>::PoSWProof: UnwindSafe,
<N as Network>::ProgramAffineCurve: UnwindSafe,
<N as Network>::ProgramID: UnwindSafe,
<N as Network>::RecordCiphertext: UnwindSafe,
<N as Network>::RecordViewKey: UnwindSafe,
<N as Network>::SerialNumber: UnwindSafe,
<N as Network>::TransactionID: UnwindSafe,
<N as Network>::TransactionIDParameters: RefUnwindSafe,
<N as Network>::TransactionsRoot: UnwindSafe,
<N as Network>::TransactionsRootParameters: RefUnwindSafe,
<N as Network>::TransitionID: UnwindSafe,
<N as Network>::TransitionIDParameters: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more