From: Matt Corallo Date: Tue, 21 May 2019 01:38:26 +0000 (-0400) Subject: Fix dup block request bug X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=be1557a3e209577270d3ee6e992f10f7960d17c7;p=dnsseed-rust Fix dup block request bug --- diff --git a/src/main.rs b/src/main.rs index 86d394d..a6b7155 100644 --- a/src/main.rs +++ b/src/main.rs @@ -139,11 +139,13 @@ pub fn scan_node(scan_time: Instant, node: SocketAddr) { state_lock.recvd_addrs = false; return future::err(()); } - if let Err(_) = write.try_send(NetworkMessage::GetData(vec![Inventory { - inv_type: InvType::WitnessBlock, - hash: state_lock.request.1, - }])) { - return future::err(()); + if !state_lock.recvd_addrs { + if let Err(_) = write.try_send(NetworkMessage::GetData(vec![Inventory { + inv_type: InvType::WitnessBlock, + hash: state_lock.request.1, + }])) { + return future::err(()); + } } state_lock.recvd_addrs = true; unsafe { DATA_STORE.as_ref().unwrap() }.add_fresh_nodes(&addrs);