Skip to content

Commit

Permalink
new [with-validators-N] parameter (where N must in range of 1..6) all…
Browse files Browse the repository at this point in the history
…ows in nogui mode to add up to 6 additional validators on start.

pooling rate of node status reduced to 10 seconds.
  • Loading branch information
neodiX committed Aug 8, 2024
1 parent c47826a commit 86c4468
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### Changes in this release

- Update TON binaries as of v2024.06 mainnet
- Update TON binaries as of v2024.06 testnet
- new [with-validators-N] parameter (where N must in range of 1..6) allows in nogui mode to add up to 6 additional
validators on start.
- pooling rate of node status reduced to 10 seconds.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msv

## MyLocalTon usage

`java -jar MyLocalTon-x86-64.jar [nogui] [ton-http-api] [explorer] [ip.addr.xxx.xxx] [test-binaries] [debug]`
`java -jar MyLocalTon-x86-64.jar [nogui] [ton-http-api] [explorer] [ip.addr.xxx.xxx] [test-binaries] [with-validators-N] [debug]`

for ARM64 architecture use:

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/ton/actions/MyLocalTon.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public void runNodesStatusMonitor() {
}
});
}
}, 0L, 15L, TimeUnit.SECONDS);
}, 0L, 10L, TimeUnit.SECONDS);
}

public static final class AtomicBigInteger {
Expand Down Expand Up @@ -1765,7 +1765,7 @@ public void createFullnode(Node node, boolean enableLiteServer, boolean start) t
}
return;
}
log.info("creating new fullnode {}", node.getNodeName());
log.info("creating new {}", node.getNodeName());
node.extractBinaries();

ValidatorEngine validatorEngine = new ValidatorEngine();
Expand Down
38 changes: 38 additions & 0 deletions src/main/java/org/ton/main/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
import javafx.stage.StageStyle;
import javafx.stage.WindowEvent;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.ton.actions.MyLocalTon;
import org.ton.db.DbPool;
import org.ton.executors.dhtserver.DhtServer;
import org.ton.executors.validatorengine.ValidatorEngine;
import org.ton.executors.validatorengine.ValidatorEngineExecutor;
import org.ton.java.smartcontract.types.WalletVersion;
import org.ton.settings.MyLocalTonSettings;
import org.ton.settings.Node;
import org.ton.ui.controllers.MainController;
Expand All @@ -23,6 +25,7 @@
import org.ton.utils.MyLocalTonUtils;

import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -213,6 +216,41 @@ public static void main(MyLocalTonSettings settings, MyLocalTon myLocalTon, Stri

myLocalTon.runValidationMonitor();

if (!Arrays.asList(args).isEmpty()) {
for (String arg : args) {
if (arg.contains("with-validators-")) {
int i = Integer.parseInt(arg.replace("with-validators-", ""));
if ((i <= 0) || (i > 6)) {
log.error("Wrong number of validators. Allowed values 1..6. No validators will be added.");
break;
}
log.info("adding {} validators", i);

for (int j = 2; j <= i + 1; j++) {
Node node = settings.getNodeByName("node" + j);
if (settings.getActiveNodes().contains(node.getNodeName())) {
log.info(node.getNodeName() + " already added");
} else {

//creating additional validator node
log.info("creating validator {}", node.getNodeName());

//delete unfinished or failed node creation
FileUtils.deleteQuietly(new File(MyLocalTonSettings.MY_APP_DIR + File.separator + node.getNodeName()));

MyLocalTon.getInstance().createFullnode(node, true, true);

settings.getActiveNodes().add(node.getNodeName());
MyLocalTon.getInstance().saveSettingsToGson();

log.info("Creating new validator controlling smart-contract (wallet) for node {}", node.getNodeName());
MyLocalTon.getInstance().createWalletEntity(node, null, WalletVersion.V3R2, -1L, settings.getWalletSettings().getDefaultSubWalletId(), node.getInitialValidatorWalletAmount(), true);
}
}
}
}
}

mainController.addValidatorBtn.setDisable(false);
}
}

0 comments on commit 86c4468

Please sign in to comment.