Fix slow/stuck unstaking due to toggling in epoch (#13501)

* Fix slow/stuck unstaking due to toggling in epoch

* nits

* nits

* Add stake_program_v2 feature status check to cli

Co-authored-by: Tyera Eulberg <tyera@solana.com>
This commit is contained in:
Ryo Onodera
2020-11-12 06:11:57 +09:00
committed by GitHub
parent 38f15e41b5
commit 89b474e192
9 changed files with 422 additions and 108 deletions

View File

@ -234,7 +234,10 @@ pub(crate) mod tests {
let result: Vec<_> = epoch_stakes_and_lockouts(&bank, first_leader_schedule_epoch);
assert_eq!(
result,
vec![(leader_stake.stake(first_leader_schedule_epoch, None), None)]
vec![(
leader_stake.stake(first_leader_schedule_epoch, None, true),
None
)]
);
// epoch stakes and lockouts are saved off for the future epoch, should
@ -244,8 +247,14 @@ pub(crate) mod tests {
let stake_history =
from_account::<StakeHistory>(&bank.get_account(&stake_history::id()).unwrap()).unwrap();
let mut expected = vec![
(leader_stake.stake(bank.epoch(), Some(&stake_history)), None),
(other_stake.stake(bank.epoch(), Some(&stake_history)), None),
(
leader_stake.stake(bank.epoch(), Some(&stake_history), true),
None,
),
(
other_stake.stake(bank.epoch(), Some(&stake_history), true),
None,
),
];
expected.sort();