own stash identification fix

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch 2025-02-17 17:31:37 +03:00
parent 6e7104f229
commit 5e90456fdf
Signed by: str3tch
GPG Key ID: 84F3190747EE79AA

View File

@ -34,6 +34,7 @@ pub struct CurrentValidators {
table_state: TableState,
individual: Vec<EraRewardPoints>,
known_validators: std::collections::HashMap<[u8; 32], String>,
active_validators: std::collections::HashSet<String>,
total_points: u32,
era_index: u32,
my_stash_id: Option<[u8; 32]>,
@ -57,6 +58,7 @@ impl CurrentValidators {
table_state: TableState::new(),
individual: Default::default(),
known_validators: Default::default(),
active_validators: Default::default(),
total_points: 0,
era_index: 0,
my_stash_id: None,
@ -268,7 +270,14 @@ impl Component for CurrentValidators {
}
if self.my_stash_id.is_some() && index == 0 {
let mut current_validator_is_my_stash = false;
if index == 0 {
if let Some(account_id) = self.my_stash_id {
current_validator_is_my_stash = account_id == info.account_id;
}
};
if current_validator_is_my_stash {
let name = self.known_validators
.get(&info.account_id)
.cloned()