Struct solana::bank::Bank [−][src]
pub struct Bank { pub is_leader: bool, // some fields omitted }
The state of all accounts and contracts after processing its entries.
Fields
is_leader: bool
This bool allows us to submit metrics that are specific for leaders or validators
It is set to true
by fullnode before creating the bank.
Methods
impl Bank
[src]
impl Bank
pub fn new_default(is_leader: bool) -> Self
[src]
pub fn new_default(is_leader: bool) -> Self
Create a default Bank
pub fn new_from_deposit(deposit: &Payment) -> Self
[src]
pub fn new_from_deposit(deposit: &Payment) -> Self
Create an Bank using a deposit.
pub fn new(mint: &Mint) -> Self
[src]
pub fn new(mint: &Mint) -> Self
Create an Bank with only a Mint. Typically used by unit tests.
pub fn last_id(&self) -> Hash
[src]
pub fn last_id(&self) -> Hash
Return the last entry ID registered.
pub fn clear_signatures(&self)
[src]
pub fn clear_signatures(&self)
Forget all signatures. Useful for benchmarking.
pub fn count_valid_ids(&self, ids: &[Hash]) -> Vec<(usize, u64)>
[src]
pub fn count_valid_ids(&self, ids: &[Hash]) -> Vec<(usize, u64)>
Look through the last_ids and find all the valid ids This is batched to avoid holding the lock for a significant amount of time
Return a vec of tuple of (valid index, timestamp) index is into the passed ids slice to avoid copying hashes
pub fn register_entry_id(&self, last_id: &Hash)
[src]
pub fn register_entry_id(&self, last_id: &Hash)
Tell the bank which Entry IDs exist on the ledger. This function
assumes subsequent calls correspond to later entries, and will boot
the oldest ones once its internal cache is full. Once boot, the
bank will reject transactions using that last_id
.
pub fn process_transaction(&self, tx: &Transaction) -> Result<()>
[src]
pub fn process_transaction(&self, tx: &Transaction) -> Result<()>
Process a Transaction. If it contains a payment plan that requires a witness to progress, the payment plan will be stored in the bank.
pub fn process_transactions(
&self,
txs: Vec<Transaction>
) -> Vec<Result<Transaction>>
[src]
pub fn process_transactions(
&self,
txs: Vec<Transaction>
) -> Vec<Result<Transaction>>
Process a batch of transactions.
pub fn process_entry(&self, entry: Entry) -> Result<()>
[src]
pub fn process_entry(&self, entry: Entry) -> Result<()>
pub fn process_entries(&self, entries: Vec<Entry>) -> Result<u64>
[src]
pub fn process_entries(&self, entries: Vec<Entry>) -> Result<u64>
Process an ordered list of entries.
pub fn process_ledger<I>(&self, entries: I) -> Result<(u64, Vec<Entry>)> where
I: IntoIterator<Item = Entry>,
[src]
pub fn process_ledger<I>(&self, entries: I) -> Result<(u64, Vec<Entry>)> where
I: IntoIterator<Item = Entry>,
Process a full ledger.
pub fn transfer(
&self,
n: i64,
keypair: &Keypair,
to: Pubkey,
last_id: Hash
) -> Result<Signature>
[src]
pub fn transfer(
&self,
n: i64,
keypair: &Keypair,
to: Pubkey,
last_id: Hash
) -> Result<Signature>
Create, sign, and process a Transaction from keypair
to to
of
n
tokens where last_id
is the last Entry ID observed by the client.
pub fn transfer_on_date(
&self,
n: i64,
keypair: &Keypair,
to: Pubkey,
dt: DateTime<Utc>,
last_id: Hash
) -> Result<Signature>
[src]
pub fn transfer_on_date(
&self,
n: i64,
keypair: &Keypair,
to: Pubkey,
dt: DateTime<Utc>,
last_id: Hash
) -> Result<Signature>
Create, sign, and process a postdated Transaction from keypair
to to
of n
tokens on dt
where last_id
is the last Entry ID
observed by the client.
pub fn get_balance(&self, pubkey: &Pubkey) -> i64
[src]
pub fn get_balance(&self, pubkey: &Pubkey) -> i64
pub fn transaction_count(&self) -> usize
[src]
pub fn transaction_count(&self) -> usize
pub fn has_signature(&self, signature: &Signature) -> bool
[src]
pub fn has_signature(&self, signature: &Signature) -> bool
pub fn finality(&self) -> usize
[src]
pub fn finality(&self) -> usize
pub fn set_finality(&self, finality: usize)
[src]
pub fn set_finality(&self, finality: usize)