Determine vote_state ahead of time (#8303) (#8521)

automerge
This commit is contained in:
mergify[bot]
2020-02-27 18:32:27 -08:00
committed by GitHub
parent 7b23e79922
commit 2c3632a042
8 changed files with 594 additions and 55 deletions

View File

@@ -138,8 +138,11 @@ pub fn update_node(
authorized_voter_pubkey: &Pubkey,
node_pubkey: &Pubkey,
) -> Instruction {
let account_metas =
vec![AccountMeta::new(*vote_pubkey, false)].with_signer(authorized_voter_pubkey);
let account_metas = vec![
AccountMeta::new(*vote_pubkey, false),
AccountMeta::new_readonly(sysvar::clock::id(), false),
]
.with_signer(authorized_voter_pubkey);
Instruction::new(
id(),
@@ -205,9 +208,12 @@ pub fn process_instruction(
&signers,
&Clock::from_keyed_account(next_keyed_account(keyed_accounts)?)?,
),
VoteInstruction::UpdateNode(node_pubkey) => {
vote_state::update_node(me, &node_pubkey, &signers)
}
VoteInstruction::UpdateNode(node_pubkey) => vote_state::update_node(
me,
&node_pubkey,
&signers,
&Clock::from_keyed_account(next_keyed_account(keyed_accounts)?)?,
),
VoteInstruction::Vote(vote) => {
inc_new_counter_info!("vote-native", 1);
vote_state::process_vote(