Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
carllin committed Feb 15, 2020
1 parent 2217323 commit 78ceea6
Show file tree
Hide file tree
Showing 4 changed files with 374 additions and 68 deletions.
2 changes: 1 addition & 1 deletion cli/src/vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ pub fn process_show_vote_account(
build_balance_message(vote_account.lamports, use_lamports_unit, true)
);
println!("Validator Identity: {}", vote_state.node_pubkey);
println!("Authorized Voter: {}", vote_state.authorized_voter);
println!("Authorized Voter: {:?}", vote_state.authorized_voter());
println!(
"Authorized Withdrawer: {}",
vote_state.authorized_withdrawer
Expand Down
19 changes: 14 additions & 5 deletions programs/vote/src/vote_instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ pub enum VoteError {

#[error("authorized voter has already been changed this epoch")]
TooSoonToReauthorize,

#[error("cannot set same authorized voter as latest authorized voter")]
ReauthorizedSameVoter,
}

impl<E> DecodeError<E> for VoteError {
Expand Down Expand Up @@ -138,8 +141,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(),
Expand Down Expand Up @@ -205,9 +211,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) => {
datapoint_debug!("vote-native", ("count", 1, i64));
vote_state::process_vote(
Expand Down
Loading

0 comments on commit 78ceea6

Please sign in to comment.