use full history depth for rewards
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
parent
0d329e4340
commit
a6ebb90ede
@ -2,7 +2,7 @@
|
|||||||
name = "ghost-eye"
|
name = "ghost-eye"
|
||||||
authors = ["str3tch <stretch@ghostchain.io>"]
|
authors = ["str3tch <stretch@ghostchain.io>"]
|
||||||
description = "Application for interacting with Casper/Ghost nodes that are exposing RPC only to the localhost"
|
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"
|
edition = "2021"
|
||||||
homepage = "https://git.ghostchain.io/ghostchain"
|
homepage = "https://git.ghostchain.io/ghostchain"
|
||||||
repository = "https://git.ghostchain.io/ghostchain/ghost-eye"
|
repository = "https://git.ghostchain.io/ghostchain/ghost-eye"
|
||||||
|
@ -68,7 +68,7 @@ impl History {
|
|||||||
fn payout_all_available(&mut self) {
|
fn payout_all_available(&mut self) {
|
||||||
let unclaimed_keys = self.rewards
|
let unclaimed_keys = self.rewards
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|(k, v)| (!v.is_claimed).then(|| *k))
|
.filter_map(|(k, v)| (!v.is_claimed && v.reward > 0).then(|| *k))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
if let Some(action_tx) = &self.action_tx {
|
if let Some(action_tx) = &self.action_tx {
|
||||||
@ -219,7 +219,10 @@ impl History {
|
|||||||
impl PartialComponent for History {
|
impl PartialComponent for History {
|
||||||
fn set_active(&mut self, current_tab: CurrentTab) {
|
fn set_active(&mut self, current_tab: CurrentTab) {
|
||||||
match current_tab {
|
match current_tab {
|
||||||
CurrentTab::History => self.is_active = true,
|
CurrentTab::History => {
|
||||||
|
self.is_active = true;
|
||||||
|
self.pending_payout = Default::default();
|
||||||
|
},
|
||||||
_ => self.is_active = false,
|
_ => self.is_active = false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -289,9 +289,7 @@ pub async fn get_validator_staking_results(
|
|||||||
|
|
||||||
let start = current_era.saturating_sub(era_depth);
|
let start = current_era.saturating_sub(era_depth);
|
||||||
for era_index in (start..current_era).rev() {
|
for era_index in (start..current_era).rev() {
|
||||||
if get_validator_staking_result(action_tx, api, account_id, era_index).await? {
|
get_validator_staking_result(action_tx, api, account_id, era_index).await?;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -301,11 +299,11 @@ pub async fn get_validator_staking_result(
|
|||||||
api: &OnlineClient<CasperConfig>,
|
api: &OnlineClient<CasperConfig>,
|
||||||
account_id: &[u8; 32],
|
account_id: &[u8; 32],
|
||||||
era_index: u32,
|
era_index: u32,
|
||||||
) -> Result<bool> {
|
) -> Result<()> {
|
||||||
let no_more_rewards = get_validator_reward_in_era(action_tx, api, account_id, era_index).await?;
|
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_claims_in_era(action_tx, api, account_id, era_index).await?;
|
||||||
get_validator_slashes_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(
|
pub async fn get_current_validator_reward_in_era(
|
||||||
@ -358,7 +356,7 @@ async fn get_validator_reward_in_era(
|
|||||||
api: &OnlineClient<CasperConfig>,
|
api: &OnlineClient<CasperConfig>,
|
||||||
account_id: &[u8; 32],
|
account_id: &[u8; 32],
|
||||||
era_index: u32,
|
era_index: u32,
|
||||||
) -> Result<bool> {
|
) -> Result<()> {
|
||||||
let maybe_era_reward_points = super::raw_calls::staking::eras_reward_points(api, None, era_index).await?;
|
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();
|
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,
|
None => 0u128,
|
||||||
};
|
};
|
||||||
|
|
||||||
let no_more_rewards = if my_reward > 0 {
|
|
||||||
action_tx.send(Action::SetValidatorEraReward(era_index, my_reward))?;
|
action_tx.send(Action::SetValidatorEraReward(era_index, my_reward))?;
|
||||||
false
|
|
||||||
} else {
|
|
||||||
true
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(no_more_rewards)
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_validator_claims_in_era(
|
async fn get_validator_claims_in_era(
|
||||||
|
Loading…
Reference in New Issue
Block a user