diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/HandleFloodfillDatabaseStoreMessageJob.java b/router/java/src/net/i2p/router/networkdb/kademlia/HandleFloodfillDatabaseStoreMessageJob.java index 04815fc74a..c28fa376fc 100644 --- a/router/java/src/net/i2p/router/networkdb/kademlia/HandleFloodfillDatabaseStoreMessageJob.java +++ b/router/java/src/net/i2p/router/networkdb/kademlia/HandleFloodfillDatabaseStoreMessageJob.java @@ -98,11 +98,13 @@ public void runJob() { dontBlamePeer = true; // store the peer in the outboundCache instead so that we can reply back with it without confusing ourselves. if (ls.isCurrent(Router.CLOCK_FUDGE_FACTOR / 4)) { - LeaseSet compareLeasesetDate = getContext().clientMessagePool().getCache().multihomedCache.get(key); - if (compareLeasesetDate == null) - getContext().clientMessagePool().getCache().multihomedCache.put(key, ls); - else if (compareLeasesetDate.getEarliestLeaseDate() < ls.getEarliestLeaseDate()) - getContext().clientMessagePool().getCache().multihomedCache.put(key, ls); + if (_facade.validate(key, ls) == null) { + LeaseSet compareLeasesetDate = getContext().clientMessagePool().getCache().multihomedCache.get(key); + if (compareLeasesetDate == null) + getContext().clientMessagePool().getCache().multihomedCache.put(key, ls); + else if (compareLeasesetDate.getEarliestLeaseDate() < ls.getEarliestLeaseDate()) + getContext().clientMessagePool().getCache().multihomedCache.put(key, ls); + } } throw new IllegalArgumentException("Peer attempted to store local leaseSet: " + key.toBase32()); diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java b/router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java index 862ac999e2..a0fefefe65 100644 --- a/router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java +++ b/router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java @@ -889,7 +889,7 @@ private final void writeMyInfo(RouterInfo info) { * @throws UnsupportedCryptoException if that's why it failed. * @return reason why the entry is not valid, or null if it is valid */ - private String validate(Hash key, LeaseSet leaseSet) throws UnsupportedCryptoException { + public String validate(Hash key, LeaseSet leaseSet) throws UnsupportedCryptoException { if (!key.equals(leaseSet.getHash())) { if (_log.shouldLog(Log.WARN)) _log.warn("Invalid store attempt! key does not match leaseSet.destination! key = "