fix for disabled validator index

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch 2025-12-06 13:33:28 +03:00
parent ce86092119
commit ffb2f3787e
Signed by: str3tch
GPG Key ID: 84F3190747EE79AA
3 changed files with 24 additions and 20 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.82"
version = "0.3.83"
edition = "2021"
homepage = "https://git.ghostchain.io/ghostchain"
repository = "https://git.ghostchain.io/ghostchain/ghost-eye"

View File

@ -91,8 +91,8 @@ impl Component for Health {
self.tx_pool_length,
self.peers_as_string(),
self.is_syncing_as_string(),
self.validators_count,
self.nominators_count);
self.validators_count + 1,
self.nominators_count + 1);
let span = Span::styled(message, Style::new().dim());
let paragraph = Paragraph::new(span).left_aligned();

View File

@ -1,3 +1,5 @@
use std::collections::BTreeMap;
use color_eyre::Result;
use subxt::{
backend::rpc::RpcClient,
@ -358,26 +360,28 @@ pub async fn get_current_validator_reward_in_era(
let (total_points, individual) = match maybe_era_reward_points {
Some(era_reward_points) => {
let mut individual_era_reward_points = Vec::new();
for index in 0..validators.len() {
let (account_id, points) = era_reward_points
.individual
.get(index)
.cloned()
.unwrap_or((validators[index].clone(), 0));
let points_map: BTreeMap<[u8; 32], u32> = era_reward_points.individual
.iter()
.map(|reward_info| (reward_info.0.0, reward_info.1))
.collect();
let extended_era_reward_points = validators.into_iter()
.enumerate()
.map(|(index, account_id)| {
let points = points_map.get(&account_id.0).copied().unwrap_or_default();
let address = AccountId32::from(account_id.0)
.to_ss58check_with_version(Ss58AddressFormat::custom(1996));
individual_era_reward_points.push(EraRewardPoints {
EraRewardPoints {
address,
points,
account_id: account_id.0,
disabled: disabled_validators.contains(&(index as u32)),
});
}
})
.collect();
(era_reward_points.total, individual_era_reward_points)
(era_reward_points.total, extended_era_reward_points)
},
None => (0, Vec::new()),
};