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

Commit

Permalink
Fix active vote account close error (#26250)
Browse files Browse the repository at this point in the history
(cherry picked from commit fa77cc5)
  • Loading branch information
jstarry authored and mergify[bot] committed Jun 28, 2022
1 parent e6f68e0 commit bde76cf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions programs/vote/src/vote_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ pub enum VoteError {

#[error("Proposed root is not in slot hashes")]
RootOnDifferentFork,

#[error("Cannot close vote account unless it stopped voting at least one full epoch ago")]
ActiveVoteAccountClose,
}

impl<E> DecodeError<E> for VoteError {
Expand Down
2 changes: 1 addition & 1 deletion programs/vote/src/vote_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ mod tests {
&serialize(&VoteInstruction::Withdraw(lamports)).unwrap(),
transaction_accounts.clone(),
instruction_accounts.clone(),
Err(InstructionError::ActiveVoteAccountClose),
Err(VoteError::ActiveVoteAccountClose.into()),
);

// Both features disabled:
Expand Down
2 changes: 1 addition & 1 deletion programs/vote/src/vote_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ pub fn withdraw<S: std::hash::BuildHasher>(

if reject_active_vote_account_close {
datapoint_debug!("vote-account-close", ("reject-active", 1, i64));
return Err(InstructionError::ActiveVoteAccountClose);
return Err(VoteError::ActiveVoteAccountClose.into());
} else {
// Deinitialize upon zero-balance
datapoint_debug!("vote-account-close", ("allow", 1, i64));
Expand Down

0 comments on commit bde76cf

Please sign in to comment.