move Account to solana-sdk (bp #13198) (#13269)

* move Account to solana-sdk (#13198)

(cherry picked from commit c458d4b213)

# Conflicts:
#	programs/bpf/benches/bpf_loader.rs

* resolve conflicts

Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
mergify[bot]
2020-10-29 19:16:52 +00:00
committed by GitHub
parent 9922f09a1d
commit 69b3f10207
37 changed files with 453 additions and 457 deletions

View File

@@ -1,6 +1,6 @@
//! DEPRECATED: This sysvar can be removed once the pico-inflation feature is enabled
//!
use crate::{account::Account, sysvar::Sysvar};
use crate::sysvar::Sysvar;
crate::declare_sysvar_id!("SysvarRewards111111111111111111111111111111", Rewards);
@@ -10,25 +10,13 @@ pub struct Rewards {
pub validator_point_value: f64,
pub unused: f64,
}
impl Rewards {
pub fn new(validator_point_value: f64) -> Self {
Self {
validator_point_value,
unused: 0.0,
}
}
}
impl Sysvar for Rewards {}
pub fn create_account(lamports: u64, validator_point_value: f64) -> Account {
Rewards {
validator_point_value,
unused: 0.0,
}
.create_account(lamports)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_create_account() {
let account = create_account(1, 0.0);
let rewards = Rewards::from_account(&account).unwrap();
assert_eq!(rewards, Rewards::default());
}
}