Skip to content

Commit

Permalink
stake() will block adding a cooldown on creation && fix bug with chan…
Browse files Browse the repository at this point in the history
…ging delegate to self
  • Loading branch information
kstepanovdev committed Aug 26, 2024
1 parent 61855c5 commit 26c6cff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ pub fn change_delegate(ctx: Context<ChangeDelegate>, deposit_entry_index: u8) ->
MplStakingError::InvalidMining
);
target.delegate = delegate_voter.voter_authority;
target.delegate_last_update_ts = curr_ts;
}
target.delegate_last_update_ts = curr_ts;

let reward_pool = ctx.accounts.reward_pool.to_account_info();
let mining = ctx.accounts.deposit_mining.to_account_info();
Expand Down
3 changes: 2 additions & 1 deletion programs/voter-stake-registry/src/instructions/stake.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{cpi_instructions, Stake};
use crate::{clock_unix_timestamp, cpi_instructions, Stake};
use anchor_lang::prelude::*;
use mplx_staking_states::{error::MplStakingError, state::LockupKind};

Expand Down Expand Up @@ -60,6 +60,7 @@ pub fn stake(
.amount_deposited_native
.checked_add(amount)
.ok_or(MplStakingError::ArithmeticOverflow)?;
target.delegate_last_update_ts = clock_unix_timestamp();

let reward_pool = ctx.accounts.reward_pool.to_account_info();
let mining = ctx.accounts.deposit_mining.to_account_info();
Expand Down

0 comments on commit 26c6cff

Please sign in to comment.