Allow NODE_NETWORK_LIMITED for full node consideration
[dnsseed-rust] / src / main.rs
index 7f9409055c6102fca15108528acf8db37ab5c660..dd87140e7fe39ce471687202a1e61229f3e4deb0 100644 (file)
@@ -101,7 +101,7 @@ pub fn scan_node(scan_time: Instant, node: SocketAddr) {
                                                state_lock.fail_reason = AddressState::LowVersion;
                                                return future::err(());
                                        }
-                                       if ver.services & 1 != 1 {
+                                       if ver.services & (1 | (1 << 10)) == 0 {
                                                printer.add_line(format!("Updating {} to NotFullNode (services {:x})", node, ver.services), true);
                                                state_lock.fail_reason = AddressState::NotFullNode;
                                                return future::err(());
@@ -135,6 +135,12 @@ pub fn scan_node(scan_time: Instant, node: SocketAddr) {
                                        }
                                },
                                NetworkMessage::Addr(addrs) => {
+                                       if addrs.len() > 1000 {
+                                               state_lock.fail_reason = AddressState::ProtocolViolation;
+                                               printer.add_line(format!("Updating {} to ProtocolViolation due to oversized addr: {}", node, addrs.len()), true);
+                                               state_lock.recvd_addrs = false;
+                                               return future::err(());
+                                       }
                                        state_lock.recvd_addrs = true;
                                        unsafe { DATA_STORE.as_ref().unwrap() }.add_fresh_nodes(&addrs);
                                },