Browse Source

daemon fix

master
Slixe 1 year ago
parent
commit
b6231e6f25
3 changed files with 9 additions and 6 deletions
  1. +5
    -0
      src/main/java/fr/slixe/dero4j/Daemon.java
  2. +2
    -4
      src/main/java/fr/slixe/tipbot/TipBot.java
  3. +2
    -2
      src/main/java/fr/slixe/tipbot/Wallet.java

+ 5
- 0
src/main/java/fr/slixe/dero4j/Daemon.java View File

@@ -13,6 +13,11 @@ public class Daemon
{
private final String host;
public Daemon(String host)
{
this.host = host + (host.endsWith("/") ? "" : "/") + "json_rpc";
}
public Daemon(String host, int port)
{
this.host = String.format("http://%s:%d/json_rpc", host, port);


+ 2
- 4
src/main/java/fr/slixe/tipbot/TipBot.java View File

@@ -126,10 +126,8 @@ public class TipBot extends KrobotModule {
wallet.start();
String daemonHost = this.config.at("wallet.daemon");
String[] daemonSplit = daemonHost.split(":");
String daemonAddress = daemonSplit[0];
int daemonPort = Integer.parseInt(daemonSplit[1]);
this.daemon = new Daemon(daemonAddress, daemonPort);
this.daemon = new Daemon(daemonHost);
timer.scheduleAtFixedRate(task, 0, TimeUnit.SECONDS.toMillis(30));
timer.scheduleAtFixedRate(verifyTask, 0, TimeUnit.SECONDS.toMillis(30));


+ 2
- 2
src/main/java/fr/slixe/tipbot/Wallet.java View File

@@ -53,11 +53,11 @@ public class Wallet {
log.error(String.format("Error! Please verify your config, wallet file not found at '%s'.", path));
System.exit(1);
}
this.thread = new Thread(() -> {
try {
String cmd[] = {path, "--testnet", "--rpc-server", String.format("--rpc-bind=%s:%d", host, port), String.format("--rpc-login=%s:%s", username, password),
String cmd[] = {path, /*"--testnet",*/ "--rpc-server", String.format("--rpc-bind=%s:%d", host, port), String.format("--rpc-login=%s:%s", username, password),
String.format("--daemon-address=%s", daemon), String.format("--wallet-file=%s", walletPath), String.format("--password=%s", walletPassword)};
ProcessBuilder builder = new ProcessBuilder(cmd)/*.redirectInput(Redirect.INHERIT)*/.redirectError(Redirect.INHERIT).redirectOutput(Redirect.INHERIT);
this.process = builder.start();


Loading…
Cancel
Save