Trait snapps_txn_reference_impl::ledger::Ledger[][src]

pub trait Ledger {
    type Index;
    fn root_hash(ledger: &Self) -> Hash;
fn find_index(ledger: &Self, public_key: PublicKey) -> Option<Self::Index>;
fn next_index(ledger: &Self) -> Self::Index;
fn get_account<'a>(ledger: &Self, index: &Self::Index) -> Account<'a>;
fn set_account(ledger: &mut Self, index: &Self::Index, account: Account<'_>); }
Expand description

Interface for ledgers

Associated Types

Type of positions in the ledger

Required methods

Return the root hash of the ledger

Find the position in the ledger for the account with public key public_key.

If there is no account in the ledger with public key public_key, find_index(public_key) must return None.

Return the next unused index in the ledger.

If there are no unused indexes remaining in the ledger, this function must raise an error that aborts the transaction as invalid.

Return the account in the ledger at the given index.

Set the contents of the account in the ledger at the specified index.

Implementors