Reject close of active vote accounts (#22651)
* 10461 Reject close of vote accounts unless it earned no credits in the previous epoch. This is checked by comparing current epoch (from clock sysvar) with the most recent epoch with credits in vote state.
This commit is contained in:
@@ -119,7 +119,24 @@ pub fn process_instruction(
|
||||
} else {
|
||||
None
|
||||
};
|
||||
vote_state::withdraw(me, lamports, to, &signers, rent_sysvar.as_deref())
|
||||
|
||||
let clock_if_feature_active = if invoke_context
|
||||
.feature_set
|
||||
.is_active(&feature_set::reject_vote_account_close_unless_zero_credit_epoch::id())
|
||||
{
|
||||
Some(invoke_context.get_sysvar_cache().get_clock()?)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
vote_state::withdraw(
|
||||
me,
|
||||
lamports,
|
||||
to,
|
||||
&signers,
|
||||
rent_sysvar.as_deref(),
|
||||
clock_if_feature_active.as_deref(),
|
||||
)
|
||||
}
|
||||
VoteInstruction::AuthorizeChecked(vote_authorize) => {
|
||||
if invoke_context
|
||||
|
Reference in New Issue
Block a user