Skip to content

Commit

Permalink
Use epoch_of_snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
guibescos committed Oct 16, 2023
1 parent 1808d5a commit c2d6c78
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions staking/programs/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,6 @@ pub mod staking {
let epoch_of_snapshot: u64;
voter_record.weight_action = Some(action);

if let Some(transfer_epoch) = ctx.accounts.stake_account_metadata.transfer_epoch {
if get_current_epoch(config)? < transfer_epoch {
return Err(error!(ErrorCode::VoteDuringTransferEpoch));
}
}

match action {
VoterWeightAction::CastVote => {
let proposal_account: &AccountInfo = ctx
Expand Down Expand Up @@ -477,6 +471,12 @@ pub mod staking {
return Err(error!(ErrorCode::InvalidVotingEpoch));
}

if let Some(transfer_epoch) = ctx.accounts.stake_account_metadata.transfer_epoch {
if epoch_of_snapshot <= transfer_epoch {
return Err(error!(ErrorCode::VoteDuringTransferEpoch));
}
}

voter_record.voter_weight = compute_voter_weight(
stake_account_positions,
epoch_of_snapshot,
Expand Down

0 comments on commit c2d6c78

Please sign in to comment.