move StakeReward to stake_rewards.rs (#32014)
This commit is contained in:
parent
c87ff8780a
commit
36ccc71220
|
@ -70,6 +70,7 @@ use {
|
||||||
sorted_storages::SortedStorages,
|
sorted_storages::SortedStorages,
|
||||||
stake_account::{self, StakeAccount},
|
stake_account::{self, StakeAccount},
|
||||||
stake_history::StakeHistory,
|
stake_history::StakeHistory,
|
||||||
|
stake_rewards::StakeReward,
|
||||||
stake_weighted_timestamp::{
|
stake_weighted_timestamp::{
|
||||||
calculate_stake_weighted_timestamp, MaxAllowableDrift,
|
calculate_stake_weighted_timestamp, MaxAllowableDrift,
|
||||||
MAX_ALLOWABLE_DRIFT_PERCENTAGE_FAST, MAX_ALLOWABLE_DRIFT_PERCENTAGE_SLOW_V2,
|
MAX_ALLOWABLE_DRIFT_PERCENTAGE_FAST, MAX_ALLOWABLE_DRIFT_PERCENTAGE_SLOW_V2,
|
||||||
|
@ -1129,19 +1130,6 @@ pub struct CommitTransactionCounts {
|
||||||
pub signature_count: u64,
|
pub signature_count: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(AbiExample, Debug, Serialize, Deserialize, Clone, PartialEq)]
|
|
||||||
pub(crate) struct StakeReward {
|
|
||||||
stake_pubkey: Pubkey,
|
|
||||||
stake_reward_info: RewardInfo,
|
|
||||||
stake_account: AccountSharedData,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl StakeReward {
|
|
||||||
fn get_stake_reward(&self) -> i64 {
|
|
||||||
self.stake_reward_info.lamports
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// allow [StakeReward] to be passed to `StoreAccounts` directly without copies or vec construction
|
/// allow [StakeReward] to be passed to `StoreAccounts` directly without copies or vec construction
|
||||||
impl<'a> StorableAccounts<'a, AccountSharedData> for (Slot, &'a [StakeReward], IncludeSlotInHash) {
|
impl<'a> StorableAccounts<'a, AccountSharedData> for (Slot, &'a [StakeReward], IncludeSlotInHash) {
|
||||||
fn pubkey(&self, index: usize) -> &Pubkey {
|
fn pubkey(&self, index: usize) -> &Pubkey {
|
||||||
|
|
|
@ -71,6 +71,7 @@ pub mod snapshot_utils;
|
||||||
pub mod sorted_storages;
|
pub mod sorted_storages;
|
||||||
mod stake_account;
|
mod stake_account;
|
||||||
pub mod stake_history;
|
pub mod stake_history;
|
||||||
|
mod stake_rewards;
|
||||||
pub mod stake_weighted_timestamp;
|
pub mod stake_weighted_timestamp;
|
||||||
pub mod stakes;
|
pub mod stakes;
|
||||||
pub mod static_ids;
|
pub mod static_ids;
|
||||||
|
|
|
@ -719,7 +719,7 @@ mod test_bank_serialize {
|
||||||
|
|
||||||
// This some what long test harness is required to freeze the ABI of
|
// This some what long test harness is required to freeze the ABI of
|
||||||
// Bank's serialization due to versioned nature
|
// Bank's serialization due to versioned nature
|
||||||
#[frozen_abi(digest = "9BucA5MtPMNNUjADyV27vNgzvDy1RqCLH2gRq5NEuDEF")]
|
#[frozen_abi(digest = "8LhKH71kTwmagxUGJA6Es58p8fejJsSAdgEmtL3xZdoY")]
|
||||||
#[derive(Serialize, AbiExample)]
|
#[derive(Serialize, AbiExample)]
|
||||||
pub struct BankAbiTestWrapperNewer {
|
pub struct BankAbiTestWrapperNewer {
|
||||||
#[serde(serialize_with = "wrapper_newer")]
|
#[serde(serialize_with = "wrapper_newer")]
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
//! Code for stake and vote rewards
|
||||||
|
|
||||||
|
use {
|
||||||
|
crate::bank::RewardInfo,
|
||||||
|
solana_sdk::{account::AccountSharedData, pubkey::Pubkey},
|
||||||
|
};
|
||||||
|
|
||||||
|
#[derive(AbiExample, Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||||
|
pub(crate) struct StakeReward {
|
||||||
|
pub(crate) stake_pubkey: Pubkey,
|
||||||
|
pub(crate) stake_reward_info: RewardInfo,
|
||||||
|
pub(crate) stake_account: AccountSharedData,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl StakeReward {
|
||||||
|
pub(crate) fn get_stake_reward(&self) -> i64 {
|
||||||
|
self.stake_reward_info.lamports
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue