From 1ec27ac1e61c625f434fd5b5f84a16be0b041f5d Mon Sep 17 00:00:00 2001 From: Uncle Stretch Date: Wed, 12 Nov 2025 20:35:48 +0300 Subject: [PATCH] change slashing spans calculation based on @f4ts0 solution Signed-off-by: Uncle Stretch --- Cargo.toml | 2 +- src/network/predefined_calls.rs | 15 +-------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7c35e56..c0653af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "ghost-eye" authors = ["str3tch "] 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" homepage = "https://git.ghostchain.io/ghostchain" repository = "https://git.ghostchain.io/ghostchain/ghost-eye" diff --git a/src/network/predefined_calls.rs b/src/network/predefined_calls.rs index 67348c6..5ef49f4 100644 --- a/src/network/predefined_calls.rs +++ b/src/network/predefined_calls.rs @@ -593,20 +593,7 @@ pub async fn get_slashing_spans( ) -> Result<()> { let slashing_spans_length = super::raw_calls::staking::slashing_spans(api, None, account_id) .await? - .map(|spans| { - 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() - }) + .map(|spans| spans.prior.saturating_add(1)) .unwrap_or_default(); action_tx.send(Action::SetSlashingSpansLength(slashing_spans_length, *account_id))?; Ok(())