From d8d9f7c61e0b6b86472ad09bb038d7024ec23382 Mon Sep 17 00:00:00 2001 From: drcpu Date: Mon, 28 Oct 2024 09:10:46 +0000 Subject: [PATCH] feat(validations): improve error stake validator/withdrawer error --- validations/src/validations.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/validations/src/validations.rs b/validations/src/validations.rs index 998a3a9c9..6ee2c01e2 100644 --- a/validations/src/validations.rs +++ b/validations/src/validations.rs @@ -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 {