Skip to content

Commit

Permalink
reworked custom binaries handling
Browse files Browse the repository at this point in the history
  • Loading branch information
neodix42 committed Oct 23, 2024
1 parent fc37476 commit 64ee920
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 60 deletions.
16 changes: 13 additions & 3 deletions src/main/java/org/ton/actions/MyLocalTon.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public void createGenesisValidator(Node node, String myGlobalConfig) throws Exce
log.debug("Starting temporary full-node...");
Process validatorProcess = new ValidatorEngine().startValidatorWithoutParams(node, myGlobalConfig).getLeft();

log.debug("sleep 5sec");
log.debug("sleep 5s");
Thread.sleep(5000);
ValidatorEngineConsole validatorEngineConsole = new ValidatorEngineConsole();

Expand Down Expand Up @@ -377,7 +377,12 @@ public WalletEntity createWalletWithFundsAndSmartContract(Node fromNode, WalletV
Thread.sleep(2000);
myWallet.installWalletSmartContract(fromNode, walletAddress);
} else {
mainController.showErrorMsg(String.format("Failed to send %s Toncoins to %s", amount, walletAddress.getNonBounceableAddressBase64Url()), 5);
if (!GraphicsEnvironment.isHeadless()) {
mainController.showErrorMsg(String.format("Failed to send %s Toncoins to %s", amount, walletAddress.getNonBounceableAddressBase64Url()), 5);
}
else {
log.error(String.format("Failed to send %s Toncoins to %s", amount, walletAddress.getNonBounceableAddressBase64Url()));
}
}

return walletEntity;
Expand Down Expand Up @@ -426,7 +431,12 @@ public WalletEntity createFaucetWalletWithFundsAndSmartContract(Node fromNode, W
Thread.sleep(2000);
myWallet.installWalletSmartContract(fromNode, walletAddress);
} else {
mainController.showErrorMsg(String.format("Failed to send %s Toncoins to %s", amount, walletAddress.getNonBounceableAddressBase64Url()), 5);
if (!GraphicsEnvironment.isHeadless()) {
mainController.showErrorMsg(String.format("Failed to send %s Toncoins to %s", amount, walletAddress.getNonBounceableAddressBase64Url()), 5);
}
else {
log.error(String.format("Failed to send %s Toncoins to %s", amount, walletAddress.getNonBounceableAddressBase64Url()));
}
}

return walletEntity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public void configureGenesisZeroState() throws IOException {

MyLocalTonSettings settings = MyLocalTon.getInstance().getSettings();

String genZeroStateFifPath = CURRENT_DIR + File.separator + MY_LOCAL_TON + File.separator + "genesis" + File.separator + "bin" + File.separator + "smartcont" + File.separator + "gen-zerostate.fif";
String genZeroStateFifPath = settings.getGenesisNode().getTonBinDir() + File.separator + "smartcont" + File.separator + "gen-zerostate.fif";
String genZeroStateFif = FileUtils.readFileToString(new File(genZeroStateFifPath), StandardCharsets.UTF_8);
String genZeroStateFifNew = "";

Expand Down
4 changes: 0 additions & 4 deletions src/main/java/org/ton/main/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ public static void main(MyLocalTonSettings settings, MyLocalTon myLocalTon, Stri

Node genesisNode = settings.getGenesisNode();
genesisNode.extractBinaries();
if (nonNull(settings.getCustomTonBinariesPath())) {
genesisNode.setTonCustomBinDir(settings.getCustomTonBinariesPath());
}

if (!Arrays.asList(args).isEmpty()) {
for (String arg : args) {
Expand Down Expand Up @@ -246,7 +243,6 @@ public static void main(MyLocalTonSettings settings, MyLocalTon myLocalTon, Stri
//creating additional validator node
log.info("creating validator {}", node.getNodeName());
node.setTonLogLevel(settings.getGenesisNode().getTonLogLevel());
node.setTonCustomBinDir(settings.getGenesisNode().getTonCustomBinDir());

//delete unfinished or failed node creation
FileUtils.deleteQuietly(new File(MyLocalTonSettings.MY_APP_DIR + File.separator + node.getNodeName()));
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/ton/settings/GenesisNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public class GenesisNode implements Serializable, Node {

String tonLogLevel = "INFO";
public String myLocalTonLogLevel = "INFO";
String tonCustomBinDir;

String validatorPrvKeyHex;
String validatorPrvKeyBase64;
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/org/ton/settings/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ default String getTonDbDir() {
}

default String getTonBinDir() {
if (nonNull(getTonCustomBinDir())) {
return getTonCustomBinDir() + File.separator;
}
return CURRENT_DIR + File.separator + MY_LOCAL_TON + File.separator + this.getNodeName() + File.separator + "bin" + File.separator;
}

Expand Down Expand Up @@ -326,7 +323,4 @@ default boolean nodeShutdown() {

void setTonLogLevel(String logLevel);

void setTonCustomBinDir(String path);
String getTonCustomBinDir();

}
1 change: 0 additions & 1 deletion src/main/java/org/ton/settings/Node2.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class Node2 implements Serializable, Node {
Long validatorSyncBefore = 3600L; // 1h, initial sync download all blocks for last given seconds default=3600, 1 hour

String tonLogLevel = "ERROR";
String tonCustomBinDir;

String validatorMonitoringPubKeyHex;
String validatorMonitoringPubKeyInteger;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/ton/settings/Node3.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class Node3 implements Serializable, Node {
Long validatorSyncBefore = 3600L; // 1h, initial sync download all blocks for last given seconds default=3600, 1 hour

String tonLogLevel = "ERROR";
String tonCustomBinDir;

String validatorMonitoringPubKeyHex;
String validatorMonitoringPubKeyInteger;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/ton/settings/Node4.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class Node4 implements Serializable, Node {
Long validatorSyncBefore = 3600L; // 1h, initial sync download all blocks for last given seconds default=3600, 1 hour

String tonLogLevel = "ERROR";
String tonCustomBinDir;

String validatorMonitoringPubKeyHex;
String validatorMonitoringPubKeyInteger;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/ton/settings/Node5.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class Node5 implements Serializable, Node {
Long validatorSyncBefore = 3600L; // 1h, initial sync download all blocks for last given seconds default=3600, 1 hour

String tonLogLevel = "ERROR";
String tonCustomBinDir;

String validatorMonitoringPubKeyHex;
String validatorMonitoringPubKeyInteger;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/ton/settings/Node6.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class Node6 implements Serializable, Node {
Long validatorSyncBefore = 3600L; // 1h, initial sync download all blocks for last given seconds default=3600, 1 hour

String tonLogLevel = "ERROR";
String tonCustomBinDir;

String validatorMonitoringPubKeyHex;
String validatorMonitoringPubKeyInteger;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/ton/settings/Node7.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class Node7 implements Serializable, Node {
Long validatorSyncBefore = 3600L; // 1h, initial sync download all blocks for last given seconds default=3600, 1 hour

String tonLogLevel = "ERROR";
String tonCustomBinDir;

String validatorMonitoringPubKeyHex;
String validatorMonitoringPubKeyInteger;
Expand Down
Loading

0 comments on commit 64ee920

Please sign in to comment.