remove mining_pool from stake_state (#4804)
This commit is contained in:
@ -18,13 +18,6 @@ use std::cmp;
|
|||||||
pub enum StakeState {
|
pub enum StakeState {
|
||||||
Uninitialized,
|
Uninitialized,
|
||||||
Stake(Stake),
|
Stake(Stake),
|
||||||
MiningPool {
|
|
||||||
/// epoch for which this Pool will redeem rewards
|
|
||||||
epoch: u64,
|
|
||||||
|
|
||||||
/// the number of lamports each point is worth
|
|
||||||
point_value: f64,
|
|
||||||
},
|
|
||||||
RewardsPool,
|
RewardsPool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,10 +423,8 @@ mod tests {
|
|||||||
Err(InstructionError::InsufficientFunds)
|
Err(InstructionError::InsufficientFunds)
|
||||||
);
|
);
|
||||||
|
|
||||||
let stake_state = StakeState::MiningPool {
|
let stake_state = StakeState::RewardsPool;
|
||||||
epoch: 0,
|
|
||||||
point_value: 0.0,
|
|
||||||
};
|
|
||||||
stake_keyed_account.set_state(&stake_state).unwrap();
|
stake_keyed_account.set_state(&stake_state).unwrap();
|
||||||
assert!(stake_keyed_account
|
assert!(stake_keyed_account
|
||||||
.delegate_stake(&vote_keyed_account, 0, ¤t)
|
.delegate_stake(&vote_keyed_account, 0, ¤t)
|
||||||
@ -627,10 +618,7 @@ mod tests {
|
|||||||
let mut to_keyed_account = KeyedAccount::new(&to, false, &mut to_account);
|
let mut to_keyed_account = KeyedAccount::new(&to, false, &mut to_account);
|
||||||
|
|
||||||
let mut stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &mut stake_account);
|
let mut stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &mut stake_account);
|
||||||
let stake_state = StakeState::MiningPool {
|
let stake_state = StakeState::RewardsPool;
|
||||||
epoch: 0,
|
|
||||||
point_value: 0.0,
|
|
||||||
};
|
|
||||||
stake_keyed_account.set_state(&stake_state).unwrap();
|
stake_keyed_account.set_state(&stake_state).unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -128,14 +128,6 @@ impl Stakes {
|
|||||||
&self.vote_accounts
|
&self.vote_accounts
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mining_pools(&self) -> impl Iterator<Item = (&Pubkey, &Account)> {
|
|
||||||
self.stake_accounts
|
|
||||||
.iter()
|
|
||||||
.filter(|(_key, account)| match StakeState::from(account) {
|
|
||||||
Some(StakeState::MiningPool { .. }) => true,
|
|
||||||
_ => false,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
pub fn rewards_pools(&self) -> impl Iterator<Item = (&Pubkey, &Account)> {
|
pub fn rewards_pools(&self) -> impl Iterator<Item = (&Pubkey, &Account)> {
|
||||||
self.stake_accounts
|
self.stake_accounts
|
||||||
.iter()
|
.iter()
|
||||||
|
Reference in New Issue
Block a user