Move `RewardInterval` to runtime (#34146)
Move RewardInterval to runtime
This commit is contained in:
parent
d9147d7a77
commit
a3670054be
|
@ -57,14 +57,6 @@ pub struct AccountLocks {
|
||||||
readonly_locks: HashMap<Pubkey, u64>,
|
readonly_locks: HashMap<Pubkey, u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
|
|
||||||
pub enum RewardInterval {
|
|
||||||
/// the slot within the epoch is INSIDE the reward distribution interval
|
|
||||||
InsideInterval,
|
|
||||||
/// the slot within the epoch is OUTSIDE the reward distribution interval
|
|
||||||
OutsideInterval,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl AccountLocks {
|
impl AccountLocks {
|
||||||
fn is_locked_readonly(&self, key: &Pubkey) -> bool {
|
fn is_locked_readonly(&self, key: &Pubkey) -> bool {
|
||||||
self.readonly_locks
|
self.readonly_locks
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
pub mod account_rent_state;
|
pub mod account_rent_state;
|
||||||
|
|
||||||
use {
|
use {
|
||||||
crate::accounts::account_rent_state::{check_rent_state_with_account, RentState},
|
crate::{
|
||||||
|
accounts::account_rent_state::{check_rent_state_with_account, RentState},
|
||||||
|
bank::RewardInterval,
|
||||||
|
},
|
||||||
itertools::Itertools,
|
itertools::Itertools,
|
||||||
log::warn,
|
log::warn,
|
||||||
solana_accounts_db::{
|
solana_accounts_db::{
|
||||||
account_overrides::AccountOverrides,
|
account_overrides::AccountOverrides,
|
||||||
accounts::{LoadedTransaction, RewardInterval, TransactionLoadResult, TransactionRent},
|
accounts::{LoadedTransaction, TransactionLoadResult, TransactionRent},
|
||||||
accounts_db::AccountsDb,
|
accounts_db::AccountsDb,
|
||||||
ancestors::Ancestors,
|
ancestors::Ancestors,
|
||||||
blockhash_queue::BlockhashQueue,
|
blockhash_queue::BlockhashQueue,
|
||||||
|
|
|
@ -70,7 +70,7 @@ use {
|
||||||
solana_accounts_db::{
|
solana_accounts_db::{
|
||||||
account_overrides::AccountOverrides,
|
account_overrides::AccountOverrides,
|
||||||
accounts::{
|
accounts::{
|
||||||
AccountAddressFilter, Accounts, LoadedTransaction, PubkeyAccountSlot, RewardInterval,
|
AccountAddressFilter, Accounts, LoadedTransaction, PubkeyAccountSlot,
|
||||||
TransactionLoadResult,
|
TransactionLoadResult,
|
||||||
},
|
},
|
||||||
accounts_db::{
|
accounts_db::{
|
||||||
|
@ -957,6 +957,14 @@ struct StakeRewardCalculation {
|
||||||
total_stake_rewards_lamports: u64,
|
total_stake_rewards_lamports: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
|
||||||
|
pub(super) enum RewardInterval {
|
||||||
|
/// the slot within the epoch is INSIDE the reward distribution interval
|
||||||
|
InsideInterval,
|
||||||
|
/// the slot within the epoch is OUTSIDE the reward distribution interval
|
||||||
|
OutsideInterval,
|
||||||
|
}
|
||||||
|
|
||||||
impl Bank {
|
impl Bank {
|
||||||
pub fn default_for_tests() -> Self {
|
pub fn default_for_tests() -> Self {
|
||||||
Self::default_with_accounts(Accounts::default_for_tests())
|
Self::default_with_accounts(Accounts::default_for_tests())
|
||||||
|
|
|
@ -25,7 +25,7 @@ use {
|
||||||
rayon::ThreadPoolBuilder,
|
rayon::ThreadPoolBuilder,
|
||||||
serde::{Deserialize, Serialize},
|
serde::{Deserialize, Serialize},
|
||||||
solana_accounts_db::{
|
solana_accounts_db::{
|
||||||
accounts::{AccountAddressFilter, RewardInterval},
|
accounts::AccountAddressFilter,
|
||||||
accounts_db::{AccountShrinkThreshold, DEFAULT_ACCOUNTS_SHRINK_RATIO},
|
accounts_db::{AccountShrinkThreshold, DEFAULT_ACCOUNTS_SHRINK_RATIO},
|
||||||
accounts_index::{
|
accounts_index::{
|
||||||
AccountIndex, AccountSecondaryIndexes, IndexKey, ScanConfig, ScanError, ITER_BATCH_SIZE,
|
AccountIndex, AccountSecondaryIndexes, IndexKey, ScanConfig, ScanError, ITER_BATCH_SIZE,
|
||||||
|
|
Loading…
Reference in New Issue