]> git.bitcoin.ninja Git - dnsseed-rust/commitdiff
Fix dup block request bug
authorMatt Corallo <git@bluematt.me>
Tue, 21 May 2019 01:38:26 +0000 (21:38 -0400)
committerMatt Corallo <git@bluematt.me>
Tue, 21 May 2019 01:38:26 +0000 (21:38 -0400)
src/main.rs

index 86d394d62108345417f418d5d46d7416d37d3dc9..a6b71556b558d638607cbe71f0dd62a3e109ccc9 100644 (file)
@@ -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);