From 3284d5d07e339cb36ff42ab20f4336c4b20848c6 Mon Sep 17 00:00:00 2001 From: Uncle Stretch Date: Thu, 20 Feb 2025 20:58:34 +0300 Subject: [PATCH] iterate payouts in reverse order Signed-off-by: Uncle Stretch --- src/network/predefined_calls.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network/predefined_calls.rs b/src/network/predefined_calls.rs index c5245f9..ef1ad81 100644 --- a/src/network/predefined_calls.rs +++ b/src/network/predefined_calls.rs @@ -283,7 +283,10 @@ pub async fn get_validator_staking_results( ) -> Result<()> { let current_era = super::raw_calls::staking::current_era(api, None).await?.unwrap_or(0); let era_depth = super::raw_calls::staking::history_depth(api).unwrap_or(0); - for era_index in current_era.saturating_sub(era_depth)..current_era { + + let start = current_era.saturating_sub(era_depth); + let end = current_era.saturating_sub(1); + for era_index in (start..end).rev() { if get_validator_staking_result(action_tx, api, account_id, era_index).await? { break; }