From 83e67ad9d87a1c4196ccc406abd21df9e777f194 Mon Sep 17 00:00:00 2001 From: zzz <zzz@i2pmail.org> Date: Tue, 20 Jul 2021 10:37:08 -0400 Subject: [PATCH] Sybil: Increase min display points --- .../src/net/i2p/router/web/helpers/SybilRenderer.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/helpers/SybilRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/helpers/SybilRenderer.java index 6767d53855..159d06c205 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/helpers/SybilRenderer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/helpers/SybilRenderer.java @@ -68,7 +68,7 @@ public class SybilRenderer { private static final int PAIRMAX = Analysis.PAIRMAX; private static final int MAX = Analysis.MAX; private static final double MIN_CLOSE = Analysis.MIN_CLOSE; - private static final double MIN_DISPLAY_POINTS = 12.01; + private static final double MIN_DISPLAY_POINTS = 20.0; private static final int[] HOURS = { 1, 6, 24, 7*24, 30*24, 0 }; private static final int[] DAYS = { 2, 7, 30, 90, 365, 0 }; @@ -502,6 +502,13 @@ public class SybilRenderer { * @since 0.9.38 split out from renderRouterInfoHTML() */ private void renderThreatsHTML(Writer out, StringBuilder buf, long date, Map<Hash, Points> points) throws IOException { + double threshold = Analysis.DEFAULT_BLOCK_THRESHOLD; + try { + threshold = Double.parseDouble(_context.getProperty(Analysis.PROP_THRESHOLD, Double.toString(threshold))); + if (threshold < Analysis.MIN_BLOCK_POINTS) + threshold = Analysis.MIN_BLOCK_POINTS; + } catch (NumberFormatException nfe) {} + final double minDisplay = Math.min(threshold, MIN_DISPLAY_POINTS); if (!points.isEmpty()) { List<Hash> warns = new ArrayList<Hash>(points.keySet()); Collections.sort(warns, new PointsComparator(points)); @@ -510,7 +517,7 @@ public class SybilRenderer { for (Hash h : warns) { Points pp = points.get(h); double p = pp.getPoints(); - if (p < MIN_DISPLAY_POINTS) + if (p < minDisplay) break; // sorted buf.append("<p class=\"threatpoints\"><b>Threat Points: " + fmt.format(p) + "</b></p><ul>"); List<String> reasons = pp.getReasons(); -- GitLab