change slashing spans calculation based on @f4ts0 solution
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
parent
718ae51dee
commit
1ec27ac1e6
@ -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.73"
|
||||
version = "0.3.74"
|
||||
edition = "2021"
|
||||
homepage = "https://git.ghostchain.io/ghostchain"
|
||||
repository = "https://git.ghostchain.io/ghostchain/ghost-eye"
|
||||
|
||||
@ -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(())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user