change slashing spans calculation based on @f4ts0 solution

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch 2025-11-12 20:35:48 +03:00
parent 718ae51dee
commit 1ec27ac1e6
Signed by: str3tch
GPG Key ID: 84F3190747EE79AA
2 changed files with 2 additions and 15 deletions

View File

@ -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.73" version = "0.3.74"
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"

View File

@ -593,20 +593,7 @@ pub async fn get_slashing_spans(
) -> Result<()> { ) -> Result<()> {
let slashing_spans_length = super::raw_calls::staking::slashing_spans(api, None, account_id) let slashing_spans_length = super::raw_calls::staking::slashing_spans(api, None, account_id)
.await? .await?
.map(|spans| { .map(|spans| spans.prior.saturating_add(1))
let mut last_start = spans.last_start;
let mut index = spans.span_index;
let last = SlashingSpan { index, start: last_start, length: None };
let prior = spans.prior.iter().cloned().map(move |length| {
let start = last_start.saturating_sub(length);
last_start = start;
index.saturating_reduce(1);
SlashingSpan { index, start, length: Some(length) }
});
std::iter::once(last).chain(prior).count()
})
.unwrap_or_default(); .unwrap_or_default();
action_tx.send(Action::SetSlashingSpansLength(slashing_spans_length, *account_id))?; action_tx.send(Action::SetSlashingSpansLength(slashing_spans_length, *account_id))?;
Ok(()) Ok(())