Skip to content

Commit

Permalink
Move RewardInterval to runtime (#34146)
Browse files Browse the repository at this point in the history
Move RewardInterval to runtime
  • Loading branch information
LucasSte authored Nov 20, 2023
1 parent d9147d7 commit a367005
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
8 changes: 0 additions & 8 deletions accounts-db/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ pub struct AccountLocks {
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 {
fn is_locked_readonly(&self, key: &Pubkey) -> bool {
self.readonly_locks
Expand Down
7 changes: 5 additions & 2 deletions runtime/src/accounts/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
pub mod account_rent_state;

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,
log::warn,
solana_accounts_db::{
account_overrides::AccountOverrides,
accounts::{LoadedTransaction, RewardInterval, TransactionLoadResult, TransactionRent},
accounts::{LoadedTransaction, TransactionLoadResult, TransactionRent},
accounts_db::AccountsDb,
ancestors::Ancestors,
blockhash_queue::BlockhashQueue,
Expand Down
10 changes: 9 additions & 1 deletion runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ use {
solana_accounts_db::{
account_overrides::AccountOverrides,
accounts::{
AccountAddressFilter, Accounts, LoadedTransaction, PubkeyAccountSlot, RewardInterval,
AccountAddressFilter, Accounts, LoadedTransaction, PubkeyAccountSlot,
TransactionLoadResult,
},
accounts_db::{
Expand Down Expand Up @@ -957,6 +957,14 @@ struct StakeRewardCalculation {
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 {
pub fn default_for_tests() -> Self {
Self::default_with_accounts(Accounts::default_for_tests())
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/bank/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use {
rayon::ThreadPoolBuilder,
serde::{Deserialize, Serialize},
solana_accounts_db::{
accounts::{AccountAddressFilter, RewardInterval},
accounts::AccountAddressFilter,
accounts_db::{AccountShrinkThreshold, DEFAULT_ACCOUNTS_SHRINK_RATIO},
accounts_index::{
AccountIndex, AccountSecondaryIndexes, IndexKey, ScanConfig, ScanError, ITER_BATCH_SIZE,
Expand Down

0 comments on commit a367005

Please sign in to comment.