Skip to content

Commit 01c2f11

Browse files
committed
refactor(config): address post-approval review cleanups
Address three follow-up review comments after the initial approvals: - xxo1shine (Args.java:345): drop the unused `config` parameter from `applyRateLimiterConfig`; it was a leftover from the pre-refactor path that used `getRateLimiterFromConfig(config)`. - 317787106 (NodeConfig.java:387): remove the `disconnectNumberFactor` bean field and its reference.conf default — no code in this repo or in develop reads it; purely synthetic dead weight introduced by this PR. The other 7 keys listed by the reviewer are kept (actively used, legacy aliases, or public API surface); see review reply for per-key rationale. - 317787106 (Args.java:1146): switch `== null` to `StringUtils.isEmpty(...)` on the `externalIp()` fallback guard. Not a behaviour change in the current architecture (no CLI flag or other code writes `PARAMETER.nodeExternalIp` before this point, so it can only be null here), but makes the intent consistent with the `isEmpty` checks already used on lines 1145 and 1149.
1 parent 998779e commit 01c2f11

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

common/src/main/java/org/tron/core/config/args/NodeConfig.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ public class NodeConfig {
8888
private boolean allowShieldedTransactionApi = true;
8989
private double activeConnectFactor = 0.1;
9090
private double connectFactor = 0.6;
91-
private double disconnectNumberFactor = 0.4;
9291
// Legacy alias `maxActiveNodesWithSameIp` has no bean field: we only peek at it via
9392
// section.hasPath() below. Keeping it field-less means reference.conf doesn't have to
9493
// ship a default that would otherwise mask the modern `maxConnectionsWithSameIp` key.

common/src/main/resources/reference.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ node {
235235
maxFastForwardNum = 4
236236
activeConnectFactor = 0.1
237237
connectFactor = 0.6
238-
disconnectNumberFactor = 0.4
239238
# Legacy alias `maxActiveNodesWithSameIp` is still accepted from user config
240239
# (see NodeConfig alias-fallback) but is intentionally NOT defaulted here —
241240
# shipping it in reference.conf would always mask the modern `maxConnectionsWithSameIp`.

framework/src/main/java/org/tron/core/config/args/Args.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ private static void applyMiscConfig(MiscConfig mc) {
342342
* HTTP/RPC rate limiter lists still use getRateLimiterFromConfig() for
343343
* conversion to RateLimiterInitialization business objects.
344344
*/
345-
private static void applyRateLimiterConfig(RateLimiterConfig rl, Config config) {
345+
private static void applyRateLimiterConfig(RateLimiterConfig rl) {
346346
PARAMETER.rateLimiterGlobalQps = rl.getGlobal().getQps();
347347
PARAMETER.rateLimiterGlobalIpQps = rl.getGlobal().getIp().getQps();
348348
PARAMETER.rateLimiterGlobalApiQps = rl.getGlobal().getApi().getQps();
@@ -779,7 +779,7 @@ public static void applyConfigParams(
779779

780780
// Rate limiter config: bind from config.conf "rate.limiter" section
781781
rateLimiterConfig = RateLimiterConfig.fromConfig(config);
782-
applyRateLimiterConfig(rateLimiterConfig, config);
782+
applyRateLimiterConfig(rateLimiterConfig);
783783

784784
// Node backup: from NodeConfig bean
785785
applyNodeBackupConfig(nodeConfig);
@@ -1143,7 +1143,7 @@ private static void logEmptyError(String arg) {
11431143
private static void externalIp(NodeConfig nodeConfig) {
11441144
String externalIp = nodeConfig.getDiscoveryExternalIp();
11451145
if (StringUtils.isEmpty(externalIp)) {
1146-
if (PARAMETER.nodeExternalIp == null) {
1146+
if (StringUtils.isEmpty(PARAMETER.nodeExternalIp)) {
11471147
logger.info("External IP wasn't set, using ipv4 from libp2p");
11481148
PARAMETER.nodeExternalIp = PARAMETER.p2pConfig.getIp();
11491149
if (StringUtils.isEmpty(PARAMETER.nodeExternalIp)) {

0 commit comments

Comments
 (0)