Skip to content

Commit

Permalink
Add checking condition in function change_delegated_validator.
Browse files Browse the repository at this point in the history
  • Loading branch information
riversyang committed Nov 2, 2022
1 parent d4eeab9 commit eb826c7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions appchain-anchor/src/user_actions/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,11 @@ impl StakingManager for AppchainAnchor {
.get_delegator(&delegator_id, &old_validator_id)
.unwrap();
let new_validator = next_validator_set.get_validator(&new_validator_id).unwrap();
assert!(
new_validator.can_be_delegated_to,
"Validator '{}' cannot be delegated to.",
&new_validator_id
);
self.assert_validator_stake_is_valid(
new_validator.deposit_amount,
Some(new_validator.total_stake + delegator.deposit_amount),
Expand Down

0 comments on commit eb826c7

Please sign in to comment.