[−][src]Struct solana_runtime::bank::Bank
Manager for the state of all accounts and programs after processing its entries.
Fields
rc: BankRc
References to accounts, parent and signature status
src: StatusCacheRc
ancestors: HashMap<u64, usize>
The set of parents including this bank
Methods
impl Bank
[src]
pub fn new(genesis_block: &GenesisBlock) -> Self
[src]
pub fn new_with_paths(
genesis_block: &GenesisBlock,
paths: Option<String>
) -> Self
[src]
genesis_block: &GenesisBlock,
paths: Option<String>
) -> Self
pub fn new_from_parent(
parent: &Arc<Bank>,
collector_id: &Pubkey,
slot: u64
) -> Self
[src]
parent: &Arc<Bank>,
collector_id: &Pubkey,
slot: u64
) -> Self
Create a new bank that points to an immutable checkpoint of another bank.
pub fn init_from_parent(
self,
parent: &Arc<Bank>,
collector_id: &Pubkey,
slot: u64
) -> Self
[src]
self,
parent: &Arc<Bank>,
collector_id: &Pubkey,
slot: u64
) -> Self
Create a new bank that points to an immutable checkpoint of another bank.
pub fn collector_id(&self) -> &Pubkey
[src]
pub fn create_with_genesis(
genesis_block: &GenesisBlock,
account_paths: Option<String>,
status_cache_rc: &StatusCacheRc,
id: AppendVecId
) -> Self
[src]
genesis_block: &GenesisBlock,
account_paths: Option<String>,
status_cache_rc: &StatusCacheRc,
id: AppendVecId
) -> Self
pub fn slot(&self) -> u64
[src]
pub fn epoch(&self) -> u64
[src]
pub fn freeze_lock(&self) -> RwLockReadGuard<Hash>
[src]
pub fn hash(&self) -> Hash
[src]
pub fn is_frozen(&self) -> bool
[src]
pub fn freeze(&self)
[src]
pub fn epoch_schedule(&self) -> &EpochSchedule
[src]
pub fn squash(&self)
[src]
squash the parent's state up into this Bank, this Bank becomes a root
pub fn parent(&self) -> Option<Arc<Bank>>
[src]
Return the more recent checkpoint of this bank instance.
pub fn register_native_instruction_processor(
&self,
name: &str,
program_id: &Pubkey
)
[src]
&self,
name: &str,
program_id: &Pubkey
)
pub fn last_blockhash(&self) -> Hash
[src]
Return the last block hash registered.
pub fn last_blockhash_with_fee_calculator(&self) -> (Hash, FeeCalculator)
[src]
pub fn confirmed_last_blockhash(&self) -> (Hash, FeeCalculator)
[src]
pub fn clear_signatures(&self)
[src]
Forget all signatures. Useful for benchmarking.
pub fn can_commit(result: &Result<()>) -> bool
[src]
pub fn get_confirmation_timestamp(
&self,
slots_and_stakes: Vec<(u64, u64)>,
supermajority_stake: u64
) -> Option<u64>
[src]
&self,
slots_and_stakes: Vec<(u64, u64)>,
supermajority_stake: u64
) -> Option<u64>
Looks through a list of tick heights and stakes, and finds the latest tick that has achieved confirmation
pub fn register_tick(&self, hash: &Hash)
[src]
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 hash
.
pub fn process_transaction(&self, tx: &Transaction) -> Result<()>
[src]
Process a Transaction. This is used for unit tests and simply calls the vector Bank::process_transactions method.
pub fn lock_accounts<'a, 'b>(
&'a self,
txs: &'b [Transaction]
) -> LockedAccountsResults<'a, 'b>
[src]
&'a self,
txs: &'b [Transaction]
) -> LockedAccountsResults<'a, 'b>
pub fn unlock_accounts(
&self,
locked_accounts_results: &mut LockedAccountsResults
)
[src]
&self,
locked_accounts_results: &mut LockedAccountsResults
)
pub fn check_transactions(
&self,
txs: &[Transaction],
lock_results: &[Result<()>],
max_age: usize,
error_counters: &mut ErrorCounters
) -> Vec<Result<()>>
[src]
&self,
txs: &[Transaction],
lock_results: &[Result<()>],
max_age: usize,
error_counters: &mut ErrorCounters
) -> Vec<Result<()>>
pub fn load_and_execute_transactions(
&self,
txs: &[Transaction],
lock_results: &LockedAccountsResults,
max_age: usize
) -> (Vec<Result<(InstructionAccounts, InstructionLoaders, InstructionCredits)>>, Vec<Result<()>>)
[src]
&self,
txs: &[Transaction],
lock_results: &LockedAccountsResults,
max_age: usize
) -> (Vec<Result<(InstructionAccounts, InstructionLoaders, InstructionCredits)>>, Vec<Result<()>>)
pub fn commit_transactions(
&self,
txs: &[Transaction],
loaded_accounts: &[Result<(InstructionAccounts, InstructionLoaders, InstructionCredits)>],
executed: &[Result<()>]
) -> Vec<Result<()>>
[src]
&self,
txs: &[Transaction],
loaded_accounts: &[Result<(InstructionAccounts, InstructionLoaders, InstructionCredits)>],
executed: &[Result<()>]
) -> Vec<Result<()>>
#[must_use]
pub fn load_execute_and_commit_transactions(
&self,
txs: &[Transaction],
lock_results: &LockedAccountsResults,
max_age: usize
) -> Vec<Result<()>>
[src]
&self,
txs: &[Transaction],
lock_results: &LockedAccountsResults,
max_age: usize
) -> Vec<Result<()>>
Process a batch of transactions.
#[must_use]
pub fn process_transactions(&self, txs: &[Transaction]) -> Vec<Result<()>>
[src]
pub fn transfer(
&self,
n: u64,
keypair: &Keypair,
to: &Pubkey
) -> Result<Signature>
[src]
&self,
n: u64,
keypair: &Keypair,
to: &Pubkey
) -> Result<Signature>
Create, sign, and process a Transaction from keypair
to to
of
n
lamports where blockhash
is the last Entry ID observed by the client.
pub fn read_balance(account: &Account) -> u64
[src]
pub fn get_balance(&self, pubkey: &Pubkey) -> u64
[src]
Each program would need to be able to introspect its own state this is hard-coded to the Budget language
pub fn parents(&self) -> Vec<Arc<Bank>>
[src]
Compute all the parents of the bank in order
pub fn store_account(&self, pubkey: &Pubkey, account: &Account)
[src]
pub fn withdraw(&self, pubkey: &Pubkey, lamports: u64) -> Result<()>
[src]
pub fn deposit(&self, pubkey: &Pubkey, lamports: u64)
[src]
pub fn accounts(&self) -> Arc<Accounts>
[src]
pub fn set_bank_rc(&mut self, bank_rc: &BankRc, status_cache_rc: &StatusCacheRc)
[src]
pub fn set_parent(&mut self, parent: &Arc<Bank>)
[src]
pub fn get_account(&self, pubkey: &Pubkey) -> Option<Account>
[src]
pub fn get_program_accounts(
&self,
program_id: &Pubkey
) -> Vec<(Pubkey, Account)>
[src]
&self,
program_id: &Pubkey
) -> Vec<(Pubkey, Account)>
pub fn get_program_accounts_modified_since_parent(
&self,
program_id: &Pubkey
) -> Vec<(Pubkey, Account)>
[src]
&self,
program_id: &Pubkey
) -> Vec<(Pubkey, Account)>
pub fn get_account_modified_since_parent(
&self,
pubkey: &Pubkey
) -> Option<(Account, Fork)>
[src]
&self,
pubkey: &Pubkey
) -> Option<(Account, Fork)>
pub fn transaction_count(&self) -> u64
[src]
pub fn signature_count(&self) -> usize
[src]
pub fn get_signature_confirmation_status(
&self,
signature: &Signature
) -> Option<(usize, Result<()>)>
[src]
&self,
signature: &Signature
) -> Option<(usize, Result<()>)>
pub fn get_signature_status(&self, signature: &Signature) -> Option<Result<()>>
[src]
pub fn has_signature(&self, signature: &Signature) -> bool
[src]
pub fn ticks_per_slot(&self) -> u64
[src]
Return the number of ticks per slot
pub fn tick_height(&self) -> u64
[src]
Return the number of ticks since genesis.
pub fn capitalization(&self) -> u64
[src]
Return the total capititalization of the Bank
pub fn max_tick_height(&self) -> u64
[src]
Return this bank's max_tick_height
pub fn get_slots_in_epoch(&self, epoch: u64) -> u64
[src]
Return the number of slots per epoch for the given epoch
pub fn get_stakers_epoch(&self, slot: u64) -> u64
[src]
returns the epoch for which this bank's stakers_slot_offset and slot would need to cache stakers
pub fn storage_accounts(&self) -> StorageAccounts
[src]
pub fn vote_accounts(&self) -> HashMap<Pubkey, (u64, Account)>
[src]
current vote accounts for this bank along with the stake attributed to each account
pub fn epoch_vote_accounts(
&self,
epoch: u64
) -> Option<&HashMap<Pubkey, (u64, Account)>>
[src]
&self,
epoch: u64
) -> Option<&HashMap<Pubkey, (u64, Account)>>
vote accounts for the specific epoch along with the stake attributed to each account
pub fn get_epoch_and_slot_index(&self, slot: u64) -> (u64, u64)
[src]
given a slot, return the epoch and offset into the epoch this slot falls e.g. with a fixed number for slots_per_epoch, the calculation is simply:
( slot/slots_per_epoch, slot % slots_per_epoch )
pub fn is_votable(&self) -> bool
[src]
pub fn add_instruction_processor(
&mut self,
program_id: Pubkey,
process_instruction: ProcessInstruction
)
[src]
&mut self,
program_id: Pubkey,
process_instruction: ProcessInstruction
)
Add an instruction processor to intercept instructions before the dynamic loader.
pub fn compare_bank(&self, dbank: &Bank)
[src]
Trait Implementations
impl Default for Bank
[src]
impl Drop for Bank
[src]
impl Serialize for Bank
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for Bank
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl Unpin for Bank
impl Sync for Bank
impl Send for Bank
impl !RefUnwindSafe for Bank
impl !UnwindSafe for Bank
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> Typeable for T where
T: Any,
T: Any,
impl<T> Clear for T where
T: InitializableFromZeroed + ?Sized,
T: InitializableFromZeroed + ?Sized,
fn clear(&mut self)
impl<T> InitializableFromZeroed for T where
T: Default,
T: Default,
unsafe fn initialize(place: *mut T)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> Erased for T
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,