Skip to content

Commit

Permalink
safer state checking
Browse files Browse the repository at this point in the history
  • Loading branch information
brentstone committed Mar 15, 2024
1 parent 5790f75 commit cce1c9a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions crates/sdk/src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1995,11 +1995,10 @@ pub async fn build_vote_proposal(
voter_address,
Some(current_epoch),
)
.await?;
if matches!(
state,
Some(ValidatorState::Jailed) | Some(ValidatorState::Inactive)
) {
.await?
.expect("Expected to find the state of the validator");

if matches!(state, ValidatorState::Jailed | ValidatorState::Inactive) {
return Err(Error::from(TxSubmitError::CannotVoteInGovernance(
voter_address.clone(),
current_epoch,
Expand Down Expand Up @@ -2041,12 +2040,12 @@ pub async fn build_vote_proposal(
voter_address,
Some(current_epoch),
)
.await
.await?
.expect("Expected to find the state of the validator");

if !matches!(
val_state,
Some(ValidatorState::Jailed) | Some(ValidatorState::Inactive)
ValidatorState::Jailed | ValidatorState::Inactive
) {
vec![voter_address.clone()]
} else {
Expand Down

0 comments on commit cce1c9a

Please sign in to comment.