Skip to content

Commit c554b79

Browse files
committed
feat(conf): make compatible with old configurations
1 parent e57c3ab commit c554b79

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

  • framework/src/main/java/org/tron/core/config/args

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,12 +1299,17 @@ public static void setParam(final Config config) {
12991299
config.hasPath(Constant.COMMITTEE_ALLOW_TVM_BLOB) ? config
13001300
.getInt(Constant.COMMITTEE_ALLOW_TVM_BLOB) : 0;
13011301

1302-
PARAMETER.proposalVotingWindow =
1303-
config.hasPath(Constant.BLOCK_PROPOSAL_EXPIRE_TIME) ?
1304-
config.getInt(Constant.BLOCK_PROPOSAL_EXPIRE_TIME) :
1305-
(config.hasPath(Constant.COMMITTEE_PROPOSAL_VOTING_WINDOW) ?
1306-
config.getInt(Constant.COMMITTEE_PROPOSAL_VOTING_WINDOW) :
1307-
DEFAULT_PROPOSAL_VOTING_WINDOW);
1302+
if (config.hasPath(Constant.COMMITTEE_PROPOSAL_VOTING_WINDOW)) {
1303+
// Highest priority: As long as COMMITTEE-PPOSAL_VOTING-WINDOW is configured, it will be taken
1304+
PARAMETER.proposalVotingWindow = config.getInt(Constant.COMMITTEE_PROPOSAL_VOTING_WINDOW);
1305+
} else if (config.hasPath(Constant.BLOCK_PROPOSAL_EXPIRE_TIME)) {
1306+
// Secondary priority: If the former is not configured but the latter is configured,
1307+
// choose the latter
1308+
PARAMETER.proposalVotingWindow = config.getInt(Constant.BLOCK_PROPOSAL_EXPIRE_TIME);
1309+
} else {
1310+
// Lowest priority: Neither is configured, use default values
1311+
PARAMETER.proposalVotingWindow = DEFAULT_PROPOSAL_VOTING_WINDOW;
1312+
}
13081313

13091314
logConfig();
13101315
}

0 commit comments

Comments
 (0)