From 0b03d91d21c20bf8606ebc6ead347ce3105af745 Mon Sep 17 00:00:00 2001 From: Stefan Date: Thu, 7 Nov 2024 11:44:58 +0100 Subject: [PATCH] Mempool syncer: check peer for necessary service flag when adding it dynamically --- mempool/src/sync/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mempool/src/sync/mod.rs b/mempool/src/sync/mod.rs index fae20f959f..01e0035765 100644 --- a/mempool/src/sync/mod.rs +++ b/mempool/src/sync/mod.rs @@ -22,6 +22,7 @@ use nimiq_consensus::{sync::syncer::SyncEvent, ConsensusProxy}; use nimiq_hash::{Blake2bHash, Hash}; use nimiq_network_interface::{ network::Network, + peer_info::Services, request::{request_handler, RequestError}, }; use nimiq_time::sleep_until; @@ -193,7 +194,11 @@ impl MempoolSyncer { /// Add peer to discover its mempool fn add_peer(&mut self, peer_id: N::PeerId) { - if self.peers.contains(&peer_id) { + if self.peers.contains(&peer_id) + || !self + .network + .peer_provides_services(peer_id, Services::MEMPOOL) + { return; }