]> git.bitcoin.ninja Git - dnsseed-rust/commitdiff
Request block after addr recv, print subver on bad services
authorMatt Corallo <git@bluematt.me>
Tue, 21 May 2019 01:06:15 +0000 (21:06 -0400)
committerMatt Corallo <git@bluematt.me>
Tue, 21 May 2019 01:06:15 +0000 (21:06 -0400)
src/main.rs

index dd87140e7fe39ce471687202a1e61229f3e4deb0..5fd0c1a267cd04fbc9ca9f49c3032ed938c1c36d 100644 (file)
@@ -102,7 +102,7 @@ pub fn scan_node(scan_time: Instant, node: SocketAddr) {
                                                return future::err(());
                                        }
                                        if ver.services & (1 | (1 << 10)) == 0 {
-                                               printer.add_line(format!("Updating {} to NotFullNode (services {:x})", node, ver.services), true);
+                                               printer.add_line(format!("Updating {} to NotFullNode ({}: services {:x})", node, ver.user_agent, ver.services), true);
                                                state_lock.fail_reason = AddressState::NotFullNode;
                                                return future::err(());
                                        }
@@ -122,12 +122,6 @@ pub fn scan_node(scan_time: Instant, node: SocketAddr) {
                                        if let Err(_) = write.try_send(NetworkMessage::GetAddr) {
                                                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(());
-                                       }
                                },
                                NetworkMessage::Ping(v) => {
                                        if let Err(_) = write.try_send(NetworkMessage::Pong(v)) {
@@ -141,6 +135,12 @@ 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(());
+                                       }
                                        state_lock.recvd_addrs = true;
                                        unsafe { DATA_STORE.as_ref().unwrap() }.add_fresh_nodes(&addrs);
                                },