From 715da6cd6904d4fb357b04304cb338e136ceaed2 Mon Sep 17 00:00:00 2001 From: FiveMovesAhead Date: Sun, 5 Jan 2025 11:13:24 +0800 Subject: [PATCH] Only process votes for players who have active deposits. --- tig-protocol/src/contracts/algorithms.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tig-protocol/src/contracts/algorithms.rs b/tig-protocol/src/contracts/algorithms.rs index 1cd7787f..3cb824fe 100644 --- a/tig-protocol/src/contracts/algorithms.rs +++ b/tig-protocol/src/contracts/algorithms.rs @@ -148,6 +148,7 @@ pub(crate) async fn update(cache: &mut AddBlockCache) { let active_algorithm_ids = &block_data.active_ids[&ActiveType::Algorithm]; let active_breakthrough_ids = &block_data.active_ids[&ActiveType::Breakthrough]; let active_challenge_ids = &block_data.active_ids[&ActiveType::Challenge]; + let active_player_ids = &block_data.active_ids[&ActiveType::Player]; // update votes for breakthrough_state in voting_breakthroughs_state.values_mut() { @@ -156,7 +157,8 @@ pub(crate) async fn update(cache: &mut AddBlockCache) { (false, PreciseNumber::from(0)), ]); } - for (player_id, player_state) in active_players_state.iter() { + for player_id in active_player_ids.iter() { + let player_state = &active_players_state[player_id]; let player_data = &active_players_block_data[player_id]; for (breakthrough_id, vote) in player_state.votes.iter() { let yes = vote.value;