Fix active vote account close error (#26250)

This commit is contained in:
Justin Starry 2022-06-28 20:35:23 +01:00 committed by GitHub
parent 50631e274d
commit fa77cc5e48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View File

@ -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 {

View File

@ -1178,7 +1178,7 @@ mod tests {
&serialize(&VoteInstruction::Withdraw(lamports)).unwrap(),
transaction_accounts.clone(),
instruction_accounts.clone(),
Err(InstructionError::ActiveVoteAccountClose),
Err(VoteError::ActiveVoteAccountClose.into()),
);
// Both features disabled:

View File

@ -1336,7 +1336,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));