move Account to solana-sdk (#13198)
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
//!
|
||||
pub use crate::stake_history::StakeHistory;
|
||||
|
||||
use crate::{account::Account, sysvar::Sysvar};
|
||||
use crate::sysvar::Sysvar;
|
||||
|
||||
crate::declare_sysvar_id!("SysvarStakeHistory1111111111111111111111111", StakeHistory);
|
||||
|
||||
@@ -16,10 +16,6 @@ impl Sysvar for StakeHistory {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create_account(lamports: u64, stake_history: &StakeHistory) -> Account {
|
||||
stake_history.create_account(lamports)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -46,14 +42,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_create_account() {
|
||||
let lamports = 42;
|
||||
let account = StakeHistory::default().create_account(lamports);
|
||||
assert_eq!(account.data.len(), StakeHistory::size_of());
|
||||
|
||||
let stake_history = StakeHistory::from_account(&account);
|
||||
assert_eq!(stake_history, Some(StakeHistory::default()));
|
||||
|
||||
let mut stake_history = stake_history.unwrap();
|
||||
let mut stake_history = StakeHistory::default();
|
||||
for i in 0..MAX_ENTRIES as u64 + 1 {
|
||||
stake_history.add(
|
||||
i,
|
||||
@@ -73,10 +62,5 @@ mod tests {
|
||||
..StakeHistoryEntry::default()
|
||||
})
|
||||
);
|
||||
// verify the account can hold a full instance
|
||||
assert_eq!(
|
||||
StakeHistory::from_account(&stake_history.create_account(lamports)),
|
||||
Some(stake_history)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user