NTCP: Don't flood RI block unless newer

Don't accept store of our RI in RI block
This commit is contained in:
zzz
2022-04-28 10:49:13 -04:00
parent 9e4063a161
commit d6aaf3ee3a

View File

@@ -1641,10 +1641,13 @@ public class NTCPConnection implements Closeable {
_messagesRead.incrementAndGet();
try {
Hash h = ri.getHash();
if (h.equals(_context.routerHash()))
return;
RouterInfo old = _context.netDb().store(h, ri);
if (flood && !ri.equals(old)) {
FloodfillNetworkDatabaseFacade fndf = (FloodfillNetworkDatabaseFacade) _context.netDb();
if (fndf.floodConditional(ri)) {
if ((old == null || ri.getPublished() > old.getPublished()) &&
fndf.floodConditional(ri)) {
if (_log.shouldDebug())
_log.debug("Flooded the RI: " + h);
} else {
@@ -1653,7 +1656,8 @@ public class NTCPConnection implements Closeable {
}
}
} catch (IllegalArgumentException iae) {
throw new DataFormatException("RI store fail: " + ri, iae);
if (_log.shouldWarn())
_log.warn("RI store fail: " + ri, iae);
}
}