diff --git a/Cargo.toml b/Cargo.toml index c5d9206..8efc9e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "ghost-eye" authors = ["str3tch "] description = "Application for interacting with Casper/Ghost nodes that are exposing RPC only to the localhost" -version = "0.3.61" +version = "0.3.62" edition = "2021" homepage = "https://git.ghostchain.io/ghostchain" repository = "https://git.ghostchain.io/ghostchain/ghost-eye" diff --git a/src/components/validator/history.rs b/src/components/validator/history.rs index 2a97ae4..355c95e 100644 --- a/src/components/validator/history.rs +++ b/src/components/validator/history.rs @@ -68,7 +68,7 @@ impl History { fn payout_all_available(&mut self) { let unclaimed_keys = self.rewards .iter() - .filter_map(|(k, v)| (!v.is_claimed).then(|| *k)) + .filter_map(|(k, v)| (!v.is_claimed && v.reward > 0).then(|| *k)) .collect::>(); if let Some(action_tx) = &self.action_tx { @@ -219,7 +219,10 @@ impl History { impl PartialComponent for History { fn set_active(&mut self, current_tab: CurrentTab) { match current_tab { - CurrentTab::History => self.is_active = true, + CurrentTab::History => { + self.is_active = true; + self.pending_payout = Default::default(); + }, _ => self.is_active = false, } } diff --git a/src/network/predefined_calls.rs b/src/network/predefined_calls.rs index a581c5c..3e7082c 100644 --- a/src/network/predefined_calls.rs +++ b/src/network/predefined_calls.rs @@ -289,9 +289,7 @@ pub async fn get_validator_staking_results( let start = current_era.saturating_sub(era_depth); for era_index in (start..current_era).rev() { - if get_validator_staking_result(action_tx, api, account_id, era_index).await? { - break; - } + get_validator_staking_result(action_tx, api, account_id, era_index).await?; } Ok(()) } @@ -301,11 +299,11 @@ pub async fn get_validator_staking_result( api: &OnlineClient, account_id: &[u8; 32], era_index: u32, -) -> Result { - let no_more_rewards = get_validator_reward_in_era(action_tx, api, account_id, era_index).await?; +) -> Result<()> { + get_validator_reward_in_era(action_tx, api, account_id, era_index).await?; get_validator_claims_in_era(action_tx, api, account_id, era_index).await?; get_validator_slashes_in_era(action_tx, api, account_id, era_index).await?; - Ok(no_more_rewards) + Ok(()) } pub async fn get_current_validator_reward_in_era( @@ -358,7 +356,7 @@ async fn get_validator_reward_in_era( api: &OnlineClient, account_id: &[u8; 32], era_index: u32, -) -> Result { +) -> Result<()> { let maybe_era_reward_points = super::raw_calls::staking::eras_reward_points(api, None, era_index).await?; let era_reward = super::raw_calls::staking::eras_validator_reward(api, None, era_index).await?.unwrap_or_default(); @@ -376,14 +374,9 @@ async fn get_validator_reward_in_era( None => 0u128, }; - let no_more_rewards = if my_reward > 0 { - action_tx.send(Action::SetValidatorEraReward(era_index, my_reward))?; - false - } else { - true - }; + action_tx.send(Action::SetValidatorEraReward(era_index, my_reward))?; - Ok(no_more_rewards) + Ok(()) } async fn get_validator_claims_in_era(