Skip to content

Commit

Permalink
Mempool syncer: check peer for necessary service flag when adding it …
Browse files Browse the repository at this point in the history
…dynamically
  • Loading branch information
Eligioo committed Nov 7, 2024
1 parent 918a0a3 commit 95e9128
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mempool/src/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -193,7 +194,11 @@ impl<N: Network> MempoolSyncer<N> {

/// 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.clone(), Services::MEMPOOL)

Check warning on line 200 in mempool/src/sync/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

using `clone` on type `<N as Network>::PeerId` which implements the `Copy` trait

warning: using `clone` on type `<N as Network>::PeerId` which implements the `Copy` trait --> mempool/src/sync/mod.rs:200:41 | 200 | .peer_provides_services(peer_id.clone(), Services::MEMPOOL) | ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `peer_id` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy = note: `#[warn(clippy::clone_on_copy)]` on by default
{
return;
}

Expand Down

0 comments on commit 95e9128

Please sign in to comment.