From ab41109565574e6941aeff0afbe8bcce698d1b96 Mon Sep 17 00:00:00 2001 From: Boris Erakhtin Date: Fri, 27 Dec 2024 19:42:10 +0500 Subject: [PATCH] Check for peer id while iteratring over peer states --- core/network/impl/synchronizer_impl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/network/impl/synchronizer_impl.cpp b/core/network/impl/synchronizer_impl.cpp index 8a0c1926ad..d2c569fa2c 100644 --- a/core/network/impl/synchronizer_impl.cpp +++ b/core/network/impl/synchronizer_impl.cpp @@ -333,10 +333,10 @@ namespace kagome::network { std::vector selected_peers = {peer_id}; std::vector active_peers; peer_manager_->enumeratePeerState( - [&active_peers, &block_info](const PeerId &peer_id, - PeerState &peer_state) { - if (peer_state.best_block >= block_info) { - active_peers.push_back(peer_id); + [&active_peers, &block_info, &peer_id](const PeerId &p_id, + PeerState &peer_state) { + if (peer_state.best_block >= block_info and p_id != peer_id) { + active_peers.push_back(p_id); } return true; });