Account->AccountSharedData (#15691)
This commit is contained in:
committed by
GitHub
parent
61c7ce857e
commit
8a3135d17b
@@ -2,7 +2,7 @@
|
||||
//! node stakes
|
||||
use crate::vote_account::{ArcVoteAccount, VoteAccounts};
|
||||
use solana_sdk::{
|
||||
account::Account, clock::Epoch, pubkey::Pubkey, sysvar::stake_history::StakeHistory,
|
||||
account::AccountSharedData, clock::Epoch, pubkey::Pubkey, sysvar::stake_history::StakeHistory,
|
||||
};
|
||||
use solana_stake_program::stake_state::{new_stake_history_entry, Delegation, StakeState};
|
||||
use solana_vote_program::vote_state::VoteState;
|
||||
@@ -106,7 +106,7 @@ impl Stakes {
|
||||
.sum::<u64>()
|
||||
}
|
||||
|
||||
pub fn is_stake(account: &Account) -> bool {
|
||||
pub fn is_stake(account: &AccountSharedData) -> bool {
|
||||
solana_vote_program::check_id(&account.owner)
|
||||
|| solana_stake_program::check_id(&account.owner)
|
||||
&& account.data.len() >= std::mem::size_of::<StakeState>()
|
||||
@@ -115,7 +115,7 @@ impl Stakes {
|
||||
pub fn store(
|
||||
&mut self,
|
||||
pubkey: &Pubkey,
|
||||
account: &Account,
|
||||
account: &AccountSharedData,
|
||||
fix_stake_deactivate: bool,
|
||||
check_vote_init: bool,
|
||||
) -> Option<ArcVoteAccount> {
|
||||
@@ -232,7 +232,9 @@ pub mod tests {
|
||||
use solana_vote_program::vote_state::{self, VoteState, VoteStateVersions};
|
||||
|
||||
// set up some dummies for a staked node (( vote ) ( stake ))
|
||||
pub fn create_staked_node_accounts(stake: u64) -> ((Pubkey, Account), (Pubkey, Account)) {
|
||||
pub fn create_staked_node_accounts(
|
||||
stake: u64,
|
||||
) -> ((Pubkey, AccountSharedData), (Pubkey, AccountSharedData)) {
|
||||
let vote_pubkey = solana_sdk::pubkey::new_rand();
|
||||
let vote_account =
|
||||
vote_state::create_account(&vote_pubkey, &solana_sdk::pubkey::new_rand(), 0, 1);
|
||||
@@ -243,7 +245,7 @@ pub mod tests {
|
||||
}
|
||||
|
||||
// add stake to a vote_pubkey ( stake )
|
||||
pub fn create_stake_account(stake: u64, vote_pubkey: &Pubkey) -> (Pubkey, Account) {
|
||||
pub fn create_stake_account(stake: u64, vote_pubkey: &Pubkey) -> (Pubkey, AccountSharedData) {
|
||||
let stake_pubkey = solana_sdk::pubkey::new_rand();
|
||||
(
|
||||
stake_pubkey,
|
||||
@@ -260,7 +262,7 @@ pub mod tests {
|
||||
pub fn create_warming_staked_node_accounts(
|
||||
stake: u64,
|
||||
epoch: Epoch,
|
||||
) -> ((Pubkey, Account), (Pubkey, Account)) {
|
||||
) -> ((Pubkey, AccountSharedData), (Pubkey, AccountSharedData)) {
|
||||
let vote_pubkey = solana_sdk::pubkey::new_rand();
|
||||
let vote_account =
|
||||
vote_state::create_account(&vote_pubkey, &solana_sdk::pubkey::new_rand(), 0, 1);
|
||||
@@ -275,7 +277,7 @@ pub mod tests {
|
||||
stake: u64,
|
||||
epoch: Epoch,
|
||||
vote_pubkey: &Pubkey,
|
||||
) -> (Pubkey, Account) {
|
||||
) -> (Pubkey, AccountSharedData) {
|
||||
let stake_pubkey = solana_sdk::pubkey::new_rand();
|
||||
(
|
||||
stake_pubkey,
|
||||
@@ -557,7 +559,7 @@ pub mod tests {
|
||||
// not a stake account, and whacks above entry
|
||||
stakes.store(
|
||||
&stake_pubkey,
|
||||
&Account::new(1, 0, &solana_stake_program::id()),
|
||||
&AccountSharedData::new(1, 0, &solana_stake_program::id()),
|
||||
true,
|
||||
true,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user