Fixed more duplicate peers from exchange.

This commit is contained in:
Revertron
2021-02-22 15:06:36 +01:00
parent df19021c62
commit 9a9adbe251
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -330,7 +330,7 @@ fn handle_message(context: Arc<Mutex<Context>>, message: Message, peers: &mut Pe
let mut context = context.lock().unwrap();
match context.blockchain.add_block(block) {
Ok(_) => { context.bus.post(crate::event::Event::BlockchainChanged); }
Err(_) => { warn!("Error adding received block"); }
Err(_) => { warn!("Discarded received block"); }
}
});
State::idle()
+8
View File
@@ -73,6 +73,14 @@ impl Peers {
continue;
}
if self.new_peers
.iter()
.find(|a| a.clone().eq(&addr))
.is_some() {
debug!("Skipping address from exchange: {}", &addr);
continue;
}
if skip_addr(&addr) {
debug!("Skipping address from exchange: {}", &addr);
continue; // Return error in future