Skip to content

Commit

Permalink
feat(validations): improve error stake validator/withdrawer error
Browse files Browse the repository at this point in the history
  • Loading branch information
drcpu-github committed Oct 30, 2024
1 parent b2efe31 commit d8d9f7c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions validations/src/validations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1343,10 +1343,19 @@ pub fn validate_stake_transaction<'a>(
}

// A stake transaction can only stake on an existing validator if the withdrawer address is the same
stakes.check_validator_withdrawer(
match stakes.check_validator_withdrawer(
st_tx.body.output.key.validator,
st_tx.body.output.key.withdrawer,
)?;
) {
Ok(_) => (),
Err(_) => {
return Err(TransactionError::NoStakeFound {
validator: st_tx.body.output.key.validator,
withdrawer: st_tx.body.output.key.withdrawer,
}
.into());
}
}

// Check that the amount of coins to stake plus the alread staked amount is equal or smaller than the maximum allowed
let stakes_key = QueryStakesKey::Key(StakeKey {
Expand Down

0 comments on commit d8d9f7c

Please sign in to comment.