use full history depth for rewards

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch 2025-08-07 14:02:39 +03:00
parent 0d329e4340
commit a6ebb90ede
Signed by: str3tch
GPG Key ID: 84F3190747EE79AA
3 changed files with 13 additions and 17 deletions

View File

@ -2,7 +2,7 @@
name = "ghost-eye"
authors = ["str3tch <stretch@ghostchain.io>"]
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"

View File

@ -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::<Vec<_>>();
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,
}
}

View File

@ -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<CasperConfig>,
account_id: &[u8; 32],
era_index: u32,
) -> Result<bool> {
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<CasperConfig>,
account_id: &[u8; 32],
era_index: u32,
) -> Result<bool> {
) -> 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
};
Ok(no_more_rewards)
Ok(())
}
async fn get_validator_claims_in_era(