From 7c928f99eaa4918eb7226c2f88f31ab33bebc030 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Sat, 1 Dec 2018 18:31:58 +0000
Subject: [PATCH] Router: Only flood LS2 to router that supports it Use same
 version check in StoreJob for flooding

---
 .../networkdb/kademlia/FloodfillNetworkDatabaseFacade.java  | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillNetworkDatabaseFacade.java b/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillNetworkDatabaseFacade.java
index 2c905f32b7..568d7cf4f1 100644
--- a/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillNetworkDatabaseFacade.java
+++ b/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillNetworkDatabaseFacade.java
@@ -234,6 +234,7 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
                 _log.info("Flooding the entry for " + key + " to " + i + " more, just before midnight");
         }
         int flooded = 0;
+        boolean isls2 = ds.isLeaseSet() && ds.getType() != DatabaseEntry.KEY_TYPE_LEASESET;
         for (int i = 0; i < peers.size(); i++) {
             Hash peer = peers.get(i);
             RouterInfo target = lookupRouterInfoLocally(peer);
@@ -246,6 +247,11 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
                 continue;
             if (peer.equals(_context.routerHash()))
                 continue;
+            // min version checks
+            if (isls2 && !StoreJob.shouldStoreLS2To(target))
+                continue;
+            if (!StoreJob.shouldStoreTo(target))
+                continue;
             DatabaseStoreMessage msg = new DatabaseStoreMessage(_context);
             msg.setEntry(ds);
             OutNetMessage m = new OutNetMessage(_context, msg, _context.clock().now()+FLOOD_TIMEOUT, FLOOD_PRIORITY, target);
-- 
GitLab