From be1557a3e209577270d3ee6e992f10f7960d17c7 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 20 May 2019 21:38:26 -0400 Subject: [PATCH] Fix dup block request bug --- src/main.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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); -- 2.39.5