Skip to content

Commit 447ba82

Browse files
committed
feat(validations): improve error stake validator/withdrawer error
1 parent e56bcdb commit 447ba82

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

validations/src/validations.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,10 +1343,19 @@ pub fn validate_stake_transaction<'a>(
13431343
}
13441344

13451345
// A stake transaction can only stake on an existing validator if the withdrawer address is the same
1346-
stakes.check_validator_withdrawer(
1346+
match stakes.check_validator_withdrawer(
13471347
st_tx.body.output.key.validator,
13481348
st_tx.body.output.key.withdrawer,
1349-
)?;
1349+
) {
1350+
Ok(_) => (),
1351+
Err(_) => {
1352+
return Err(TransactionError::NoStakeFound {
1353+
validator: st_tx.body.output.key.validator,
1354+
withdrawer: st_tx.body.output.key.withdrawer,
1355+
}
1356+
.into());
1357+
}
1358+
}
13501359

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

0 commit comments

Comments
 (0)