Skip to content

Commit

Permalink
Merge pull request tronprotocol#497 from tronprotocol/config_min_rate
Browse files Browse the repository at this point in the history
add minParticipationRate in config
  • Loading branch information
olenheim authored Apr 21, 2018
2 parents c8c29e4 + 267a393 commit 160c995
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/main/java/org/tron/core/config/args/Args.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ public class Args {
@Setter
private int nodeMaxActiveNodes;

@Getter
@Setter
private int minParticipationRate;

@Getter
@Setter
private int nodeListenPort;
Expand Down Expand Up @@ -179,6 +183,7 @@ public static void clearParam() {
INSTANCE.nodeActive = Collections.emptyList();
INSTANCE.nodeChannelReadTimeout = 0;
INSTANCE.nodeMaxActiveNodes = 0;
INSTANCE.minParticipationRate = 0;
INSTANCE.nodeListenPort = 0;
INSTANCE.nodeDiscoveryBindIp = "";
INSTANCE.nodeExternalIp = "";
Expand Down Expand Up @@ -272,6 +277,9 @@ public static void setParam(final String[] args, final String confFileName) {
INSTANCE.nodeMaxActiveNodes =
config.hasPath("node.maxActiveNodes") ? config.getInt("node.maxActiveNodes") : 0;

INSTANCE.minParticipationRate =
config.hasPath("node.minParticipationRate") ? config.getInt("node.minParticipationRate") : 0;

INSTANCE.nodeListenPort =
config.hasPath("node.listen.port") ? config.getInt("node.listen.port") : 0;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/tron/core/services/WitnessService.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@Slf4j
public class WitnessService implements Service {

private static final int MIN_PARTICIPATION_RATE = 33; // MIN_PARTICIPATION_RATE * 1%
private static final int MIN_PARTICIPATION_RATE = Args.getInstance().getMinParticipationRate(); // MIN_PARTICIPATION_RATE * 1%
private static final int PRODUCE_TIME_OUT = 500; // ms
private Application tronApp;
@Getter
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ node {

maxActiveNodes = 30

minParticipationRate = 33

p2p {
version = 57 # 57: testnet; 101: debug
}
Expand Down

0 comments on commit 160c995

Please sign in to comment.