Add versioning (#8348)

automerge
This commit is contained in:
carllin
2020-02-25 17:12:01 -08:00
committed by GitHub
parent 6b99ab3a57
commit d821fd29d6
11 changed files with 318 additions and 102 deletions

View File

@ -18,7 +18,7 @@ use solana_stake_program::{
};
use solana_vote_program::{
vote_instruction,
vote_state::{Vote, VoteInit, VoteState},
vote_state::{Vote, VoteInit, VoteState, VoteStateVersions},
};
use std::sync::Arc;
@ -254,7 +254,9 @@ fn test_stake_account_lifetime() {
// Test that votes and credits are there
let account = bank.get_account(&vote_pubkey).expect("account not found");
let vote_state: VoteState = account.state().expect("couldn't unpack account data");
let vote_state: VoteState = StateMut::<VoteStateVersions>::state(&account)
.expect("couldn't unpack account data")
.convert_to_current();
// 1 less vote, as the first vote should have cleared the lockout
assert_eq!(vote_state.votes.len(), 31);