Struct solana_runtime::bank::Bank

source ·
pub struct Bank {
Show 16 fields pub rc: BankRc, pub status_cache: Arc<RwLock<BankStatusCache>>, pub ancestors: Ancestors, pub ns_per_slot: u128, pub rewards: RwLock<Vec<(Pubkey, RewardInfo)>>, pub cluster_type: Option<ClusterType>, pub lazy_rent_collection: AtomicBool, pub rewards_pool_pubkeys: Arc<HashSet<Pubkey>>, pub transaction_log_collector_config: Arc<RwLock<TransactionLogCollectorConfig>>, pub transaction_log_collector: Arc<RwLock<TransactionLogCollector>>, pub feature_set: Arc<FeatureSet>, pub drop_callback: RwLock<OptionalDropCallback>, pub freeze_started: AtomicBool, pub rewrites_skipped_this_slot: Rewrites, pub fee_structure: FeeStructure, pub incremental_snapshot_persistence: Option<BankIncrementalSnapshotPersistence>, /* private fields */
}
Expand description

Manager for the state of all accounts and programs after processing its entries. AbiExample is needed even without Serialize/Deserialize; actual (de-)serialization are implemented elsewhere for versioning

Fields§

§rc: BankRc

References to accounts, parent and signature status

§status_cache: Arc<RwLock<BankStatusCache>>

A cache of signature statuses

§ancestors: Ancestors

The set of parents including this bank

§ns_per_slot: u128

length of a slot in ns

§rewards: RwLock<Vec<(Pubkey, RewardInfo)>>

Protocol-level rewards that were distributed by this bank

§cluster_type: Option<ClusterType>§lazy_rent_collection: AtomicBool§rewards_pool_pubkeys: Arc<HashSet<Pubkey>>§transaction_log_collector_config: Arc<RwLock<TransactionLogCollectorConfig>>§transaction_log_collector: Arc<RwLock<TransactionLogCollector>>§feature_set: Arc<FeatureSet>§drop_callback: RwLock<OptionalDropCallback>

callback function only to be called when dropping and should only be called once

§freeze_started: AtomicBool§rewrites_skipped_this_slot: Rewrites

(Pubkey, account Hash) for each account that would have been rewritten in rent collection for this slot

§fee_structure: FeeStructure

Transaction fee structure

§incremental_snapshot_persistence: Option<BankIncrementalSnapshotPersistence>

Implementations§

source§

impl Bank

source§

impl Bank

source

pub fn default_for_tests() -> Self

source

pub fn new_for_benches(genesis_config: &GenesisConfig) -> Self

source

pub fn new_for_tests(genesis_config: &GenesisConfig) -> Self

source

pub fn new_no_wallclock_throttle_for_tests( genesis_config: &GenesisConfig ) -> Self

source

pub fn new_with_paths_for_tests( genesis_config: &GenesisConfig, paths: Vec<PathBuf>, debug_keys: Option<Arc<HashSet<Pubkey>>>, additional_builtins: Option<&Builtins>, account_indexes: AccountSecondaryIndexes, accounts_db_caching_enabled: bool, shrink_ratio: AccountShrinkThreshold, debug_do_not_add_builtins: bool, accounts_db_config: Option<AccountsDbConfig> ) -> Self

source

pub fn new_with_paths_for_benches( genesis_config: &GenesisConfig, paths: Vec<PathBuf>, debug_keys: Option<Arc<HashSet<Pubkey>>>, additional_builtins: Option<&Builtins>, account_indexes: AccountSecondaryIndexes, accounts_db_caching_enabled: bool, shrink_ratio: AccountShrinkThreshold, debug_do_not_add_builtins: bool ) -> Self

source

pub fn new_with_paths( genesis_config: &GenesisConfig, paths: Vec<PathBuf>, debug_keys: Option<Arc<HashSet<Pubkey>>>, additional_builtins: Option<&Builtins>, account_indexes: AccountSecondaryIndexes, accounts_db_caching_enabled: bool, shrink_ratio: AccountShrinkThreshold, debug_do_not_add_builtins: bool, accounts_db_config: Option<AccountsDbConfig>, accounts_update_notifier: Option<AccountsUpdateNotifier> ) -> Self

source

pub fn new_from_parent( parent: &Arc<Bank>, collector_id: &Pubkey, slot: Slot ) -> Self

Create a new bank that points to an immutable checkpoint of another bank.

source

pub fn new_from_parent_with_options( parent: &Arc<Bank>, collector_id: &Pubkey, slot: Slot, new_bank_options: NewBankOptions ) -> Self

source

pub fn new_from_parent_with_tracer( parent: &Arc<Bank>, collector_id: &Pubkey, slot: Slot, reward_calc_tracer: impl Fn(&RewardCalculationEvent<'_, '_>) + Send + Sync ) -> Self

source

pub fn byte_limit_for_scans(&self) -> Option<usize>

source

pub fn proper_ancestors_set(&self) -> HashSet<Slot>

source

pub fn set_callback(&self, callback: Option<Box<dyn DropCallback + Send + Sync>>)

source

pub fn vote_only_bank(&self) -> bool

source

pub fn warp_from_parent( parent: &Arc<Bank>, collector_id: &Pubkey, slot: Slot ) -> Self

Like new_from_parent but additionally:

  • Doesn’t assume that the parent is anywhere near slot, parent could be millions of slots in the past
  • Adjusts the new bank’s tick height to avoid having to run PoH for millions of slots
  • Freezes the new bank, assuming that the user will Bank::new_from_parent from this bank
source

pub fn collector_id(&self) -> &Pubkey

source

pub fn genesis_creation_time(&self) -> UnixTimestamp

source

pub fn slot(&self) -> Slot

source

pub fn bank_id(&self) -> BankId

source

pub fn epoch(&self) -> Epoch

source

pub fn first_normal_epoch(&self) -> Epoch

source

pub fn freeze_lock(&self) -> RwLockReadGuard<'_, Hash>

source

pub fn hash(&self) -> Hash

source

pub fn is_frozen(&self) -> bool

source

pub fn freeze_started(&self) -> bool

source

pub fn status_cache_ancestors(&self) -> Vec<u64>

source

pub fn unix_timestamp_from_genesis(&self) -> i64

computed unix_timestamp at this slot height

source

pub fn clock(&self) -> Clock

source

pub fn set_sysvar_for_tests<T>(&self, sysvar: &T)where T: Sysvar + SysvarId,

source

pub fn get_slot_history(&self) -> SlotHistory

source

pub fn epoch_duration_in_years(&self, prev_epoch: Epoch) -> f64

source

pub fn slot_in_year_for_inflation(&self) -> f64

source

pub fn update_recent_blockhashes(&self)

source

pub fn rehash(&self)

source

pub fn freeze(&self)

source

pub fn unfreeze_for_ledger_tool(&self)

source

pub fn epoch_schedule(&self) -> &EpochSchedule

source

pub fn squash(&self) -> SquashTiming

squash the parent’s state up into this Bank, this Bank becomes a root

source

pub fn parent(&self) -> Option<Arc<Bank>>

Return the more recent checkpoint of this bank instance.

source

pub fn parent_slot(&self) -> Slot

source

pub fn parent_hash(&self) -> Hash

source

pub fn add_builtin_account( &self, name: &str, program_id: &Pubkey, must_replace: bool )

Add a builtin program account

source

pub fn add_precompiled_account(&self, program_id: &Pubkey)

Add a precompiled program account

source

pub fn set_rent_burn_percentage(&mut self, burn_percent: u8)

source

pub fn set_hashes_per_tick(&mut self, hashes_per_tick: Option<u64>)

source

pub fn last_blockhash(&self) -> Hash

Return the last block hash registered.

source

pub fn last_blockhash_and_lamports_per_signature(&self) -> (Hash, u64)

source

pub fn is_blockhash_valid(&self, hash: &Hash) -> bool

source

pub fn get_minimum_balance_for_rent_exemption(&self, data_len: usize) -> u64

source

pub fn get_lamports_per_signature(&self) -> u64

source

pub fn get_lamports_per_signature_for_blockhash( &self, hash: &Hash ) -> Option<u64>

source

pub fn get_fee_rate_governor(&self) -> &FeeRateGovernor

👎Deprecated since 1.9.0: Please use get_fee_for_message instead
source

pub fn get_fee_for_message(&self, message: &SanitizedMessage) -> Option<u64>

source

pub fn get_startup_verification_complete(&self) -> &Arc<AtomicBool>

source

pub fn is_startup_verification_complete(&self) -> bool

source

pub fn set_startup_verification_complete(&self)

This can occur because it completed in the background or if the verification was run in the foreground.

source

pub fn get_fee_for_message_with_lamports_per_signature( &self, message: &SanitizedMessage, lamports_per_signature: u64 ) -> u64

source

pub fn get_blockhash_last_valid_slot(&self, blockhash: &Hash) -> Option<Slot>

👎Deprecated since 1.6.11: Please use get_blockhash_last_valid_block_height
source

pub fn get_blockhash_last_valid_block_height( &self, blockhash: &Hash ) -> Option<Slot>

source

pub fn confirmed_last_blockhash(&self) -> Hash

source

pub fn clear_signatures(&self)

Forget all signatures. Useful for benchmarking.

source

pub fn clear_slot_signatures(&self, slot: Slot)

source

pub fn register_recent_blockhash(&self, blockhash: &Hash)

Register a new recent blockhash in the bank’s recent blockhash queue. Called when a bank reaches its max tick height. Can be called by tests to get new blockhashes for transaction processing without advancing to a new bank slot.

source

pub fn register_tick(&self, hash: &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 hash.

This is NOT thread safe because if tick height is updated by two different threads, the block boundary condition could be missed.

source

pub fn is_complete(&self) -> bool

source

pub fn is_block_boundary(&self, tick_height: u64) -> bool

source

pub fn get_transaction_account_lock_limit(&self) -> usize

Get the max number of accounts that a transaction may lock in this block

source

pub fn prepare_batch_for_tests( &self, txs: Vec<Transaction> ) -> TransactionBatch<'_, '_>

Prepare a transaction batch from a list of legacy transactions. Used for tests only.

source

pub fn prepare_entry_batch( &self, txs: Vec<VersionedTransaction> ) -> Result<TransactionBatch<'_, '_>>

Prepare a transaction batch from a list of versioned transactions from an entry. Used for tests only.

source

pub fn prepare_sanitized_batch<'a, 'b>( &'a self, txs: &'b [SanitizedTransaction] ) -> TransactionBatch<'a, 'b>

Prepare a locked transaction batch from a list of sanitized transactions.

source

pub fn prepare_sanitized_batch_with_results<'a, 'b>( &'a self, transactions: &'b [SanitizedTransaction], transaction_results: impl Iterator<Item = &'b Result<()>> ) -> TransactionBatch<'a, 'b>

Prepare a locked transaction batch from a list of sanitized transactions, and their cost limited packing status

source

pub fn simulate_transaction( &self, transaction: SanitizedTransaction ) -> TransactionSimulationResult

Run transactions against a frozen bank without committing the results

source

pub fn simulate_transaction_unchecked( &self, transaction: SanitizedTransaction ) -> TransactionSimulationResult

Run transactions against a bank without committing the results; does not check if the bank is frozen, enabling use in single-Bank test frameworks

source

pub fn unlock_accounts(&self, batch: &mut TransactionBatch<'_, '_>)

source

pub fn remove_unrooted_slots(&self, slots: &[(Slot, BankId)])

source

pub fn set_shrink_paths(&self, paths: Vec<PathBuf>)

source

pub fn get_hash_age(&self, hash: &Hash) -> Option<u64>

source

pub fn is_hash_valid_for_age(&self, hash: &Hash, max_age: usize) -> bool

source

pub fn check_transactions( &self, sanitized_txs: &[SanitizedTransaction], lock_results: &[Result<()>], max_age: usize, error_counters: &mut TransactionErrorMetrics ) -> Vec<TransactionCheckResult>

source

pub fn collect_balances( &self, batch: &TransactionBatch<'_, '_> ) -> TransactionBalances

source

pub fn clear_executors(&self)

source

pub fn load_and_execute_transactions( &self, batch: &TransactionBatch<'_, '_>, max_age: usize, enable_cpi_recording: bool, enable_log_recording: bool, enable_return_data_recording: bool, timings: &mut ExecuteTimings, account_overrides: Option<&AccountOverrides>, log_messages_bytes_limit: Option<usize> ) -> LoadAndExecuteTransactionsOutput

source

pub fn accounts_data_size_limit(&self) -> u64

The maximum allowed size, in bytes, of the accounts data

source

pub fn load_accounts_data_size(&self) -> u64

Load the accounts data size, in bytes

source

pub fn load_accounts_data_size_delta(&self) -> i64

Load the change in accounts data size in this Bank, in bytes

source

pub fn load_accounts_data_size_delta_on_chain(&self) -> i64

Load the change in accounts data size in this Bank, in bytes, from on-chain events i.e. transactions

source

pub fn load_accounts_data_size_delta_off_chain(&self) -> i64

Load the change in accounts data size in this Bank, in bytes, from off-chain events i.e. rent collection

source

pub fn set_accounts_data_size_initial_for_tests(&mut self, amount: u64)

Set the initial accounts data size NOTE: This fn is ONLY FOR TESTS

source

pub fn update_accounts_data_size_delta_off_chain_for_tests(&self, amount: i64)

Update the accounts data size off-chain delta NOTE: This fn is ONLY FOR TESTS

source

pub fn calculate_fee( message: &SanitizedMessage, lamports_per_signature: u64, fee_structure: &FeeStructure, support_set_compute_unit_price_ix: bool, use_default_units_per_instruction: bool, enable_request_heap_frame_ix: bool ) -> u64

Calculate fee for SanitizedMessage

source

pub fn commit_transactions( &self, sanitized_txs: &[SanitizedTransaction], loaded_txs: &mut [TransactionLoadResult], execution_results: Vec<TransactionExecutionResult>, last_blockhash: Hash, lamports_per_signature: u64, counts: CommitTransactionCounts, timings: &mut ExecuteTimings ) -> TransactionResults

committed_transactions_count is the number of transactions out of sanitized_txs that was executed. Of those, committed_transactions_count, committed_with_failure_result_count is the number of executed transactions that returned a failure result.

source

pub fn prepare_rewrites_for_hash(&self)

after deserialize, populate rewrites with accounts that would normally have had their data rewritten in this slot due to rent collection (but didn’t)

source

pub fn partition_from_pubkey( pubkey: &Pubkey, partition_count: PartitionsPerCycle ) -> u64

This is the inverse of pubkey_range_from_partition. return the lowest end_index which would contain this pubkey

source

pub fn pubkey_range_from_partition( (start_index, end_index, partition_count): (u64, u64, PartitionsPerCycle) ) -> RangeInclusive<Pubkey>

source

pub fn get_partitions( slot: Slot, parent_slot: Slot, slot_count_in_two_day: SlotCount ) -> Vec<(u64, u64, PartitionsPerCycle)>

source

pub fn variable_cycle_partition_from_previous_slot( epoch_schedule: &EpochSchedule, slot: Slot ) -> (u64, u64, PartitionsPerCycle)

used only by filler accounts in debug path previous means slot - 1, not parent

source

pub fn slot_count_in_two_day_helper(ticks_per_slot: SlotCount) -> SlotCount

source

pub fn cluster_type(&self) -> ClusterType

source

pub fn load_execute_and_commit_transactions( &self, batch: &TransactionBatch<'_, '_>, max_age: usize, collect_balances: bool, enable_cpi_recording: bool, enable_log_recording: bool, enable_return_data_recording: bool, timings: &mut ExecuteTimings, log_messages_bytes_limit: Option<usize> ) -> (TransactionResults, TransactionBalancesSet)

Process a batch of transactions.

source

pub fn process_transaction(&self, tx: &Transaction) -> Result<()>

Process a Transaction. This is used for unit tests and simply calls the vector Bank::process_transactions method.

source

pub fn process_transaction_with_logs(&self, tx: &Transaction) -> Result<()>

Process a Transaction and store program log data. This is used for unit tests, and simply replicates the vector Bank::process_transactions method with enable_cpi_recording: true

source

pub fn process_transactions<'a>( &self, txs: impl Iterator<Item = &'a Transaction> ) -> Vec<Result<()>>

Process multiple transaction in a single batch. This is used for benches and unit tests.

Panics

Panics if any of the transactions do not pass sanitization checks.

source

pub fn try_process_transactions<'a>( &self, txs: impl Iterator<Item = &'a Transaction> ) -> Result<Vec<Result<()>>>

Process multiple transaction in a single batch. This is used for benches and unit tests. Short circuits if any of the transactions do not pass sanitization checks.

source

pub fn process_entry_transactions( &self, txs: Vec<VersionedTransaction> ) -> Vec<Result<()>>

Process entry transactions in a single batch. This is used for benches and unit tests.

Panics

Panics if any of the transactions do not pass sanitization checks.

source

pub fn try_process_entry_transactions( &self, txs: Vec<VersionedTransaction> ) -> Result<Vec<Result<()>>>

Process multiple transaction in a single batch. This is used for benches and unit tests. Short circuits if any of the transactions do not pass sanitization checks.

source

pub fn transfer(&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.

source

pub fn read_balance(account: &AccountSharedData) -> u64

source

pub fn get_balance(&self, pubkey: &Pubkey) -> u64

Each program would need to be able to introspect its own state this is hard-coded to the Budget language

source

pub fn parents(&self) -> Vec<Arc<Bank>>

Compute all the parents of the bank in order

source

pub fn parents_inclusive(self: Arc<Self>) -> Vec<Arc<Bank>>

Compute all the parents of the bank including this bank itself

source

pub fn store_account<T: ReadableAccount + Sync + ZeroLamport>( &self, pubkey: &Pubkey, account: &T )

source

pub fn store_accounts<'a, T: ReadableAccount + Sync + ZeroLamport>( &self, accounts: impl StorableAccounts<'a, T> )

source

pub fn force_flush_accounts_cache(&self)

source

pub fn flush_accounts_cache_if_needed(&self)

source

pub fn expire_old_recycle_stores(&self)

source

pub fn deposit( &self, pubkey: &Pubkey, lamports: u64 ) -> Result<u64, LamportsError>

source

pub fn accounts(&self) -> Arc<Accounts>

source

pub fn set_inflation(&self, inflation: Inflation)

source

pub fn set_compute_budget(&mut self, compute_budget: Option<ComputeBudget>)

source

pub fn hard_forks(&self) -> Arc<RwLock<HardForks>>

source

pub fn get_account(&self, pubkey: &Pubkey) -> Option<AccountSharedData>

source

pub fn get_account_with_fixed_root( &self, pubkey: &Pubkey ) -> Option<AccountSharedData>

source

pub fn get_account_modified_slot( &self, pubkey: &Pubkey ) -> Option<(AccountSharedData, Slot)>

source

pub fn get_program_accounts( &self, program_id: &Pubkey, config: &ScanConfig ) -> ScanResult<Vec<TransactionAccount>>

source

pub fn get_filtered_program_accounts<F: Fn(&AccountSharedData) -> bool>( &self, program_id: &Pubkey, filter: F, config: &ScanConfig ) -> ScanResult<Vec<TransactionAccount>>

source

pub fn get_filtered_indexed_accounts<F: Fn(&AccountSharedData) -> bool>( &self, index_key: &IndexKey, filter: F, config: &ScanConfig, byte_limit_for_scan: Option<usize> ) -> ScanResult<Vec<TransactionAccount>>

source

pub fn account_indexes_include_key(&self, key: &Pubkey) -> bool

source

pub fn get_all_accounts_with_modified_slots( &self ) -> ScanResult<Vec<PubkeyAccountSlot>>

source

pub fn get_program_accounts_modified_since_parent( &self, program_id: &Pubkey ) -> Vec<TransactionAccount>

source

pub fn get_transaction_logs( &self, address: Option<&Pubkey> ) -> Option<Vec<TransactionLogInfo>>

source

pub fn get_all_accounts_modified_since_parent(&self) -> Vec<TransactionAccount>

source

pub fn get_largest_accounts( &self, num: usize, filter_by_address: &HashSet<Pubkey>, filter: AccountAddressFilter ) -> ScanResult<Vec<(Pubkey, u64)>>

source

pub fn transaction_count(&self) -> u64

source

pub fn transaction_error_count(&self) -> u64

source

pub fn transaction_entries_count(&self) -> u64

source

pub fn transactions_per_entry_max(&self) -> u64

source

pub fn signature_count(&self) -> u64

source

pub fn get_signature_status_processed_since_parent( &self, signature: &Signature ) -> Option<Result<()>>

source

pub fn get_signature_status_with_blockhash( &self, signature: &Signature, blockhash: &Hash ) -> Option<Result<()>>

source

pub fn get_signature_status_slot( &self, signature: &Signature ) -> Option<(Slot, Result<()>)>

source

pub fn get_signature_status(&self, signature: &Signature) -> Option<Result<()>>

source

pub fn has_signature(&self, signature: &Signature) -> bool

source

pub fn verify_bank_hash(&self, config: VerifyBankHash) -> bool

Recalculate the hash_internal_state from the account stores. Would be used to verify a snapshot. return true if all is good Only called from startup or test code.

source

pub fn set_initial_accounts_hash_verification_completed(&self)

Specify that initial verification has completed. Called internally when verification runs in the foreground thread. Also has to be called by some tests which don’t do verification on startup.

source

pub fn has_initial_accounts_hash_verification_completed(&self) -> bool

return true if bg hash verification is complete return false if bg hash verification has not completed yet if hash verification failed, a panic will occur

source

pub fn get_snapshot_storages(&self, base_slot: Option<Slot>) -> SnapshotStorages

source

pub fn verify_transaction( &self, tx: VersionedTransaction, verification_mode: TransactionVerificationMode ) -> Result<SanitizedTransaction>

source

pub fn calculate_and_verify_capitalization(&self, debug_verify: bool) -> bool

only called at startup vs steady-state runtime

source

pub fn set_capitalization(&self) -> u64

Forcibly overwrites current capitalization by actually recalculating accounts’ balances. This should only be used for developing purposes.

source

pub fn get_accounts_hash(&self) -> Hash

source

pub fn get_thread_pool(&self) -> &ThreadPool

source

pub fn load_account_into_read_cache(&self, key: &Pubkey)

source

pub fn update_accounts_hash_with_index_option( &self, use_index: bool, debug_verify: bool, is_startup: bool ) -> Hash

source

pub fn update_accounts_hash(&self) -> Hash

source

pub fn verify_snapshot_bank( &self, test_hash_calculation: bool, accounts_db_skip_shrink: bool, last_full_snapshot_slot: Option<Slot> ) -> bool

A snapshot bank should be purged of 0 lamport accounts which are not part of the hash calculation and could shield other real accounts.

source

pub fn hashes_per_tick(&self) -> &Option<u64>

Return the number of hashes per tick

source

pub fn ticks_per_slot(&self) -> u64

Return the number of ticks per slot

source

pub fn slots_per_year(&self) -> f64

Return the number of slots per year

source

pub fn tick_height(&self) -> u64

Return the number of ticks since genesis.

source

pub fn inflation(&self) -> Inflation

Return the inflation parameters of the Bank

source

pub fn rent_collector(&self) -> &RentCollector

source

pub fn capitalization(&self) -> u64

Return the total capitalization of the Bank

source

pub fn max_tick_height(&self) -> u64

Return this bank’s max_tick_height

source

pub fn block_height(&self) -> u64

Return the block_height of this bank

source

pub fn get_slots_in_epoch(&self, epoch: Epoch) -> u64

Return the number of slots per epoch for the given epoch

source

pub fn get_leader_schedule_epoch(&self, slot: Slot) -> Epoch

returns the epoch for which this bank’s leader_schedule_slot_offset and slot would need to cache leader_schedule

source

pub fn staked_nodes(&self) -> Arc<HashMap<Pubkey, u64>>

source

pub fn vote_accounts(&self) -> Arc<VoteAccountsHashMap>

current vote accounts for this bank along with the stake attributed to each account

source

pub fn get_vote_account(&self, vote_account: &Pubkey) -> Option<VoteAccount>

Vote account for the given vote account pubkey.

source

pub fn epoch_stakes(&self, epoch: Epoch) -> Option<&EpochStakes>

Get the EpochStakes for a given epoch

source

pub fn epoch_stakes_map(&self) -> &HashMap<Epoch, EpochStakes>

source

pub fn epoch_staked_nodes( &self, epoch: Epoch ) -> Option<Arc<HashMap<Pubkey, u64>>>

source

pub fn epoch_vote_accounts(&self, epoch: Epoch) -> Option<&VoteAccountsHashMap>

vote accounts for the specific epoch along with the stake attributed to each account

source

pub fn epoch_authorized_voter(&self, vote_account: &Pubkey) -> Option<&Pubkey>

Get the fixed authorized voter for the given vote account for the current epoch

source

pub fn epoch_vote_accounts_for_node_id( &self, node_id: &Pubkey ) -> Option<&NodeVoteAccounts>

Get the fixed set of vote accounts for the given node id for the current epoch

source

pub fn total_epoch_stake(&self) -> u64

Get the fixed total stake of all vote accounts for current epoch

source

pub fn epoch_vote_account_stake(&self, vote_account: &Pubkey) -> u64

Get the fixed stake of the given vote account for the current epoch

source

pub fn get_epoch_and_slot_index(&self, slot: Slot) -> (Epoch, SlotIndex)

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 )

source

pub fn get_epoch_info(&self) -> EpochInfo

source

pub fn is_empty(&self) -> bool

source

pub fn add_builtin( &mut self, name: &str, program_id: &Pubkey, process_instruction: ProcessInstructionWithContext )

Add an instruction processor to intercept instructions before the dynamic loader.

source

pub fn remove_builtin(&mut self, program_id: &Pubkey)

Remove a builtin instruction processor if it already exists

source

pub fn add_precompile(&mut self, program_id: &Pubkey)

source

pub fn clean_accounts( &self, skip_last: bool, is_startup: bool, last_full_snapshot_slot: Option<Slot> )

source

pub fn shrink_all_slots( &self, is_startup: bool, last_full_snapshot_slot: Option<Slot> )

source

pub fn print_accounts_stats(&self)

source

pub fn process_stale_slot_with_budget( &self, consumed_budget: usize, budget_recovery_delta: usize ) -> usize

source

pub fn bank_tranaction_count_fix_enabled(&self) -> bool

source

pub fn shrink_candidate_slots(&self) -> usize

source

pub fn no_overflow_rent_distribution_enabled(&self) -> bool

source

pub fn versioned_tx_message_enabled(&self) -> bool

source

pub fn credits_auto_rewind(&self) -> bool

source

pub fn send_to_tpu_vote_port_enabled(&self) -> bool

source

pub fn concurrent_replay_of_forks(&self) -> bool

source

pub fn read_cost_tracker(&self) -> LockResult<RwLockReadGuard<'_, CostTracker>>

source

pub fn write_cost_tracker( &self ) -> LockResult<RwLockWriteGuard<'_, CostTracker>>

source

pub fn should_bank_still_be_processing_txs( bank_creation_time: &Instant, max_tx_ingestion_nanos: u128 ) -> bool

source

pub fn deactivate_feature(&mut self, id: &Pubkey)

source

pub fn activate_feature(&mut self, id: &Pubkey)

source

pub fn fill_bank_with_ticks_for_tests(&self)

source

pub fn get_total_accounts_stats(&self) -> ScanResult<TotalAccountsStats>

Get all the accounts for this bank and calculate stats

source

pub fn calculate_total_accounts_stats<'a>( &self, accounts: impl Iterator<Item = (&'a Pubkey, &'a AccountSharedData)> ) -> TotalAccountsStats

Given all the accounts for a bank, calculate stats

Trait Implementations§

source§

impl AbiExample for Bank

source§

fn example() -> Self

source§

impl AddressLoader for &Bank

source§

fn load_addresses( self, address_table_lookups: &[MessageAddressTableLookup] ) -> Result<LoadedAddresses, AddressLoaderError>

source§

impl Debug for Bank

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Bank

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl PartialEq<Bank> for Bank

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Bank

§

impl Send for Bank

§

impl Sync for Bank

§

impl Unpin for Bank

§

impl !UnwindSafe for Bank

Blanket Implementations§

source§

impl<T> AbiExample for T

source§

default fn example() -> T

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more