Skip to content

Commit

Permalink
update ton4j to 0.5.3, minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
neodiX committed Aug 26, 2024
1 parent da68dcd commit 5f4537d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<jetty.version>11.0.14</jetty.version>
<jprocesses.version>1.6.5</jprocesses.version>
<richtextfx.version>0.10.7</richtextfx.version>
<ton4j.version>0.5.1</ton4j.version>
<ton4j.version>0.5.3</ton4j.version>
<objectdb.version>2.8.6</objectdb.version>
<javax.persistence.version>2.1.0</javax.persistence.version>
<jta.version>1.1</jta.version>
Expand Down
27 changes: 11 additions & 16 deletions src/main/java/org/ton/actions/MyLocalTon.java
Original file line number Diff line number Diff line change
Expand Up @@ -680,13 +680,15 @@ public void initTonlib(Node node) {
.pathToGlobalConfig(node.getNodeGlobalConfigLocation())
.keystorePath(node.getTonlibKeystore().replace("\\", "/"))
.pathToTonlibSharedLib(tonlibName)
.ignoreCache(false)
// .verbosityLevel(VerbosityLevel.DEBUG)
.build();

tonlibBlockMonitor = Tonlib.builder()
.pathToGlobalConfig(node.getNodeGlobalConfigLocation())
.keystorePath(node.getTonlibKeystore().replace("\\", "/"))
.pathToTonlibSharedLib(tonlibName)
.ignoreCache(false)
// .verbosityLevel(VerbosityLevel.DEBUG)
.build();
}
Expand Down Expand Up @@ -730,7 +732,7 @@ public void runBlockchainMonitor(Node node) {

executorService.shutdown();

Thread.sleep(1000);
Thread.sleep(2000);

} catch (Exception e) {
e.printStackTrace();
Expand Down Expand Up @@ -875,18 +877,12 @@ private void updateAccountsTabGui(WalletEntity walletEntity) {
private void emitResultMessage(WalletEntity walletEntity) {
if (nonNull(walletEntity)) {
if (WalletVersion.V1R1.equals(walletEntity.getWalletVersion())) {
Platform.runLater(() -> {
emit(new CustomNotificationEvent(CustomEvent.Type.SUCCESS, "Wallet " + walletEntity.getFullAddress() + " created", 3));
});
Platform.runLater(() -> emit(new CustomNotificationEvent(CustomEvent.Type.SUCCESS, "Wallet " + walletEntity.getFullAddress() + " created", 3)));
} else if (walletEntity.getSeqno() != -1L) {
Platform.runLater(() -> {
emit(new CustomNotificationEvent(CustomEvent.Type.SUCCESS, "Wallet " + walletEntity.getFullAddress() + " created", 3));
});
Platform.runLater(() -> emit(new CustomNotificationEvent(CustomEvent.Type.SUCCESS, "Wallet " + walletEntity.getFullAddress() + " created", 3)));
}
} else {
Platform.runLater(() -> {
emit(new CustomNotificationEvent(CustomEvent.Type.ERROR, "Error creating wallet. See logs for details.", 4));
});
Platform.runLater(() -> emit(new CustomNotificationEvent(CustomEvent.Type.ERROR, "Error creating wallet. See logs for details.", 4)));
}
}

Expand Down Expand Up @@ -1396,13 +1392,12 @@ private void updateTopInfoBarGui(int shardsNum) {
private void updateBlocksTabGui(ResultLastBlock lastBlock) {

MainController c = fxmlLoader.getController();
ResultLastBlock finalLastBlock = lastBlock;

Platform.runLater(() -> {
try {
// update top bar
if (finalLastBlock.getWc().equals(-1L)) {
c.currentBlockNum.setSecondaryText(finalLastBlock.getSeqno().toString());
if (lastBlock.getWc().equals(-1L)) {
c.currentBlockNum.setSecondaryText(lastBlock.getSeqno().toString());
}

if (Boolean.TRUE.equals(autoScroll)) {
Expand All @@ -1416,11 +1411,11 @@ private void updateBlocksTabGui(ResultLastBlock lastBlock) {
log.error("error loading blockrow.fxml file, {}", e.getMessage());
return;
}
if (finalLastBlock.getWc() == -1L) {
if (lastBlock.getWc() == -1L) {
(blockRow.lookup("#blockRowBorderPane")).getStyleClass().add("row-pane-gray");
}

showInGuiOnlyUniqueBlocks(c, finalLastBlock, blockRow);
showInGuiOnlyUniqueBlocks(c, lastBlock, blockRow);
}
} catch (Exception e) {
log.error("error displaying block, {}", e.getMessage());
Expand Down Expand Up @@ -1641,7 +1636,7 @@ public void runAccountsMonitor() {
RawAccountState accountState = tonlib.getRawAccountState(address);
WalletVersion walletVersion = MyLocalTonUtils.detectWalletVersion(accountState.getCode(), address);

long subWalletId = -1;
long subWalletId;
long seqno = -1;

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ public String execute(Node node, String... command) {
ProcessBuilder pb = new ProcessBuilder(withBinaryCommand).redirectErrorStream(true);
Map<String, String> env = pb.environment();
if ((Utils.getOS() == Utils.OS.WINDOWS) || (Utils.getOS() == Utils.OS.WINDOWS_ARM)) {
log.debug("set FIFTPATH=" + node.getTonBinDir() + "lib" + "@" + node.getTonBinDir() + "smartcont");
env.put("FIFTPATH", node.getTonBinDir() + "lib" + "@" + node.getTonBinDir() + "smartcont");
} else {
log.debug("export FIFTPATH=" + node.getTonBinDir() + "lib" + ":" + node.getTonBinDir() + "smartcont");
env.put("FIFTPATH", node.getTonBinDir() + "lib" + ":" + node.getTonBinDir() + "smartcont");
}
pb.directory(new File(node.getTonBinDir() + "zerostate" + File.separator));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public Pair<Process, Future<String>> execute(Node node, String... command) {
Thread.currentThread().setName("lite-client-" + node.getNodeName());

String resultInput = IOUtils.toString(p.getInputStream(), Charset.defaultCharset());
log.debug("{} stopped", "lite-client-" + node.getNodeName());
p.getInputStream().close();
p.getErrorStream().close();
p.getOutputStream().close();
Expand Down

0 comments on commit 5f4537d

Please sign in to comment.