* 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:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user