From b3469c80fe3cef61c11d0903a1da1925946f3842 Mon Sep 17 00:00:00 2001 From: Age Manning Date: Fri, 11 Sep 2020 18:28:54 +1000 Subject: [PATCH 1/2] Hack to fix race condition --- beacon_node/network/src/sync/range_sync/chain_collection.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/beacon_node/network/src/sync/range_sync/chain_collection.rs b/beacon_node/network/src/sync/range_sync/chain_collection.rs index 86d31e636bd..7c91039077d 100644 --- a/beacon_node/network/src/sync/range_sync/chain_collection.rs +++ b/beacon_node/network/src/sync/range_sync/chain_collection.rs @@ -256,7 +256,9 @@ impl ChainCollection { .iter_mut() .enumerate() .find(|(iter_index, chain)| { - *iter_index != index && chain.peer_pool.len() > syncing_chain_peer_count + false + && *iter_index != index + && chain.peer_pool.len() > syncing_chain_peer_count }) { // A chain has more peers. Swap the syncing chain From 51348d8afc9c212f4be98977ecc7101c918c2776 Mon Sep 17 00:00:00 2001 From: Age Manning Date: Mon, 14 Sep 2020 09:58:02 +1000 Subject: [PATCH 2/2] Clippy lint --- .../network/src/sync/range_sync/chain_collection.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/beacon_node/network/src/sync/range_sync/chain_collection.rs b/beacon_node/network/src/sync/range_sync/chain_collection.rs index 7c91039077d..3ccbb351b70 100644 --- a/beacon_node/network/src/sync/range_sync/chain_collection.rs +++ b/beacon_node/network/src/sync/range_sync/chain_collection.rs @@ -248,17 +248,17 @@ impl ChainCollection { // Check if any chains become the new syncing chain if let Some(index) = self.finalized_syncing_index() { // There is a current finalized chain syncing - let syncing_chain_peer_count = self.finalized_chains[index].peer_pool.len(); + let _syncing_chain_peer_count = self.finalized_chains[index].peer_pool.len(); // search for a chain with more peers if let Some((new_index, chain)) = self.finalized_chains .iter_mut() .enumerate() - .find(|(iter_index, chain)| { + .find(|(_iter_index, _chain)| { false - && *iter_index != index - && chain.peer_pool.len() > syncing_chain_peer_count + // && *iter_index != index + // && chain.peer_pool.len() > syncing_chain_peer_count }) { // A chain has more peers. Swap the syncing chain