55
66import com .typesafe .config .Config ;
77import com .typesafe .config .ConfigBeanFactory ;
8- import com .typesafe .config .ConfigFactory ;
98import com .typesafe .config .ConfigValueFactory ;
109import java .util .ArrayList ;
1110import java .util .List ;
@@ -49,6 +48,9 @@ public class NodeConfig {
4948
5049 // node.discovery.* — HOCON merges into node { discovery { ... } }, auto-bound
5150 private DiscoveryConfig discovery = new DiscoveryConfig ();
51+ @ Getter (lombok .AccessLevel .NONE )
52+ @ Setter (lombok .AccessLevel .NONE )
53+ private String externalIP = "" ;
5254
5355 // node.shutdown.* uses PascalCase keys (BlockTime, BlockHeight, BlockCount)
5456 // that don't match JavaBean naming. Excluded, read manually.
@@ -64,7 +66,7 @@ public class NodeConfig {
6466
6567 public boolean isDiscoveryEnable () { return discovery .isEnable (); }
6668 public boolean isDiscoveryPersist () { return discovery .isPersist (); }
67- public String getDiscoveryExternalIp () { return discovery . getExternal (). getIp () ; }
69+ public String getDiscoveryExternalIp () { return externalIP ; }
6870 public String getShutdownBlockTime () { return shutdownBlockTime ; }
6971 public long getShutdownBlockHeight () { return shutdownBlockHeight ; }
7072 public long getShutdownBlockCount () { return shutdownBlockCount ; }
@@ -76,13 +78,10 @@ public class NodeConfig {
7678 private boolean enableIpv6 = false ;
7779 private boolean effectiveCheckEnable = false ;
7880 private int maxFastForwardNum = 4 ;
79- private int tcpNettyWorkThreadNum = 0 ;
80- private int udpNettyWorkThreadNum = 1 ;
8181 private ValidContractProtoConfig validContractProto = new ValidContractProtoConfig ();
8282 private int shieldedTransInPendingMaxCounts = 10 ;
8383 private long blockCacheTimeout = 60 ;
8484 private long receiveTcpMinDataLength = 2048 ;
85- private ChannelConfig channel = new ChannelConfig ();
8685 private int maxTransactionPendingSize = 2000 ;
8786 private long pendingTransactionTimeout = 60000 ;
8887 private int maxTrxCacheSize = 50_000 ;
@@ -91,6 +90,8 @@ public class NodeConfig {
9190 private boolean unsolidifiedBlockCheck = false ;
9291 private int maxUnsolidifiedBlocks = 54 ;
9392 private String zenTokenId = "000000" ;
93+ @ Getter (lombok .AccessLevel .NONE )
94+ @ Setter (lombok .AccessLevel .NONE )
9495 private boolean allowShieldedTransactionApi = false ;
9596 private double activeConnectFactor = 0.1 ;
9697 private double connectFactor = 0.6 ;
@@ -100,17 +101,15 @@ public class NodeConfig {
100101
101102 // ---- Sub-beans matching config's dot-notation nested structure ----
102103 private ListenConfig listen = new ListenConfig ();
103- private ConnectionConfig connection = new ConnectionConfig ();
104104 private FetchBlockConfig fetchBlock = new FetchBlockConfig ();
105105 private SolidityConfig solidity = new SolidityConfig ();
106106
107107 // Convenience getters for backward compatibility with applyNodeConfig
108108 public int getListenPort () { return listen .getPort (); }
109- public int getConnectionTimeout () { return connection .getTimeout (); }
110109 public int getFetchBlockTimeout () { return fetchBlock .getTimeout (); }
111110 public int getSolidityThreads () { return solidity .getThreads (); }
112- public int getChannelReadTimeout () { return channel .getRead ().getTimeout (); }
113111 public int getValidContractProtoThreads () { return validContractProto .getThreads (); }
112+ public boolean isAllowShieldedTransactionApi () { return allowShieldedTransactionApi ; }
114113
115114 // ---- List fields (manually read) ----
116115 private List <String > active = new ArrayList <>();
@@ -139,13 +138,6 @@ public class NodeConfig {
139138 public static class DiscoveryConfig {
140139 private boolean enable = false ;
141140 private boolean persist = false ;
142- private ExternalConfig external = new ExternalConfig ();
143-
144- @ Getter
145- @ Setter
146- public static class ExternalConfig {
147- private String ip = "" ;
148- }
149141 }
150142
151143 @ Getter
@@ -154,12 +146,6 @@ public static class ListenConfig {
154146 private int port = 18888 ;
155147 }
156148
157- @ Getter
158- @ Setter
159- public static class ConnectionConfig {
160- private int timeout = 2 ;
161- }
162-
163149 @ Getter
164150 @ Setter
165151 public static class FetchBlockConfig {
@@ -172,18 +158,6 @@ public static class SolidityConfig {
172158 private int threads = 0 ; // 0 = auto (availableProcessors)
173159 }
174160
175- @ Getter
176- @ Setter
177- public static class ChannelConfig {
178- private ReadConfig read = new ReadConfig ();
179-
180- @ Getter
181- @ Setter
182- public static class ReadConfig {
183- private int timeout = 0 ;
184- }
185- }
186-
187161 @ Getter
188162 @ Setter
189163 public static class ValidContractProtoConfig {
@@ -362,7 +336,7 @@ public static class DnsConfig {
362336 /**
363337 * Create NodeConfig from the "node" section of the application config.
364338 *
365- * <p>Dot-notation keys (listen.port, connection.timeout, fetchBlock.timeout,
339+ * <p>Dot-notation keys (listen.port, fetchBlock.timeout,
366340 * solidity.threads) become nested HOCON objects and cannot be auto-bound to flat
367341 * Java fields. They are read manually after ConfigBeanFactory binding.
368342 *
@@ -403,14 +377,23 @@ public static NodeConfig fromConfig(Config config) {
403377 nc .maxConnectionsWithSameIp = section .getInt ("maxActiveNodesWithSameIp" );
404378 }
405379
380+ nc .externalIP = getString (section , "discovery.external.ip" , "" );
381+ if ("null" .equalsIgnoreCase (nc .externalIP )) {
382+ nc .externalIP = "" ;
383+ }
384+
406385 // Legacy key fallback: node.fullNodeAllowShieldedTransaction -> allowShieldedTransactionApi.
407- // reference.conf does not ship the legacy key, so hasPath here reliably means the user
408- // set it in their config. When present, it overrides the modern key.
409- if (section .hasPath ("fullNodeAllowShieldedTransaction" )) {
410- nc .allowShieldedTransactionApi = section .getBoolean ("fullNodeAllowShieldedTransaction" );
386+ if (section .hasPath ("allowShieldedTransactionApi" )) {
387+ nc .allowShieldedTransactionApi =
388+ section .getBoolean ("allowShieldedTransactionApi" );
389+ } else if (section .hasPath ("fullNodeAllowShieldedTransaction" )) {
390+ // for compatibility with previous configuration
391+ nc .allowShieldedTransactionApi =
392+ section .getBoolean ("fullNodeAllowShieldedTransaction" );
411393 logger .warn ("Configuring [node.fullNodeAllowShieldedTransaction] will be deprecated. "
412394 + "Please use [node.allowShieldedTransactionApi] instead." );
413395 }
396+
414397 // node.shutdown.* — PascalCase keys (BlockTime, BlockHeight), cannot auto-bind
415398 nc .shutdownBlockTime = config .hasPath ("node.shutdown.BlockTime" )
416399 ? config .getString ("node.shutdown.BlockTime" ) : "" ;
0 commit comments