Skip to content

Commit abb52f6

Browse files
committed
fix(config): move ARM64 db engine constraint into setParam and fix double shutdown
- Rename validateConfig to applyPlatformConstraints, move into setParam() after applyCLIParams so RocksDB init is not skipped - Remove external validateConfig call from FullNode.main - Fix BaseMethodTest double shutdown by letting context.close() handle appT.shutdown() via TronApplicationContext
1 parent 9283aca commit abb52f6

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,19 @@ public static void setParam(final String[] args, final String confFileName) {
130130
// 3. CLI overrides Config (highest priority)
131131
applyCLIParams(cmd, jc);
132132

133-
// 4. Init witness (depends on CLI witness flag)
133+
// 4. Apply platform constraints (e.g. ARM64 forces RocksDB)
134+
applyPlatformConstraints();
135+
136+
// 5. Init witness (depends on CLI witness flag)
134137
initLocalWitnesses(config, cmd);
135138
}
136139

137140
/**
138-
* Validate final configuration after all sources (defaults, config, CLI) are applied.
139-
* ARM64 only supports RocksDB; db.engine config is ignored with a warning.
141+
* Apply platform-specific constraints after all config sources are resolved.
142+
* ARM64 does not support LevelDB (native JNI library unavailable),
143+
* so db.engine is forced to RocksDB regardless of config or CLI settings.
140144
*/
141-
public static void validateConfig() {
145+
private static void applyPlatformConstraints() {
142146
if (Arch.isArm64()
143147
&& !Constant.ROCKSDB.equalsIgnoreCase(PARAMETER.storage.getDbEngine())) {
144148
logger.warn("ARM64 only supports RocksDB, ignoring db.engine='{}'",

framework/src/main/java/org/tron/program/FullNode.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public static void main(String[] args) {
2424
ExitManager.initExceptionHandler();
2525
checkJdkVersion();
2626
Args.setParam(args, "config.conf");
27-
Args.validateConfig();
2827
CommonParameter parameter = Args.getInstance();
2928

3029
LogService.load(parameter.getLogbackPath());

framework/src/test/java/org/tron/common/BaseMethodTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,8 @@ protected void afterInit() {
7878
@After
7979
public final void destroyContext() {
8080
beforeDestroy();
81-
if (appT != null) {
82-
appT.shutdown();
83-
}
8481
if (context != null) {
85-
context.close();
82+
context.close(); // triggers appT.shutdown() via TronApplicationContext
8683
}
8784
Args.clearParam();
8885
}

0 commit comments

Comments
 (0)