]> git.bitcoin.ninja Git - dnsseed-rust/commitdiff
Require some number of addrs to count, not just one
authorMatt Corallo <git@bluematt.me>
Mon, 3 Jun 2019 18:38:35 +0000 (14:38 -0400)
committerMatt Corallo <git@bluematt.me>
Mon, 3 Jun 2019 18:38:35 +0000 (14:38 -0400)
src/main.rs

index 2c19c23a4b3f188a3d48374a7432ec3113a019ca..30c363541ceacd3f269c0aa676da6b95afb18c10 100644 (file)
@@ -138,15 +138,17 @@ pub fn scan_node(scan_time: Instant, node: SocketAddr, manual: bool) {
                                                state_lock.recvd_addrs = false;
                                                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(());
+                                       if addrs.len() > 10 {
+                                               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;
                                        }
-                                       state_lock.recvd_addrs = true;
                                        unsafe { DATA_STORE.as_ref().unwrap() }.add_fresh_nodes(&addrs);
                                },
                                NetworkMessage::Block(block) => {