mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-22 11:39:29 +00:00
update more names from bisq* to haveno*
This commit is contained in:
parent
fae477fc51
commit
e8cc3d20f5
12 changed files with 66 additions and 66 deletions
|
@ -289,13 +289,13 @@ public class Scaffold {
|
||||||
startBisqApp(bobdesktop, executor, countdownLatch);
|
startBisqApp(bobdesktop, executor, countdownLatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startBisqApp(HavenoAppConfig bisqAppConfig,
|
private void startBisqApp(HavenoAppConfig havenoAppConfig,
|
||||||
ExecutorService executor,
|
ExecutorService executor,
|
||||||
CountDownLatch countdownLatch)
|
CountDownLatch countdownLatch)
|
||||||
throws IOException, InterruptedException {
|
throws IOException, InterruptedException {
|
||||||
|
|
||||||
HavenoProcess bisqProcess = createBisqProcess(bisqAppConfig);
|
HavenoProcess bisqProcess = createBisqProcess(havenoAppConfig);
|
||||||
switch (bisqAppConfig) {
|
switch (havenoAppConfig) {
|
||||||
case seednode:
|
case seednode:
|
||||||
seedNodeTask = new SetupTask(bisqProcess, countdownLatch);
|
seedNodeTask = new SetupTask(bisqProcess, countdownLatch);
|
||||||
seedNodeTaskFuture = executor.submit(seedNodeTask);
|
seedNodeTaskFuture = executor.submit(seedNodeTask);
|
||||||
|
@ -316,9 +316,9 @@ public class Scaffold {
|
||||||
bobNodeTaskFuture = executor.submit(bobNodeTask);
|
bobNodeTaskFuture = executor.submit(bobNodeTask);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException("Unknown BisqAppConfig " + bisqAppConfig.name());
|
throw new IllegalStateException("Unknown HavenoAppConfig " + havenoAppConfig.name());
|
||||||
}
|
}
|
||||||
log.info("Giving {} ms for {} to initialize ...", config.bisqAppInitTime, bisqAppConfig.appName);
|
log.info("Giving {} ms for {} to initialize ...", config.bisqAppInitTime, havenoAppConfig.appName);
|
||||||
MILLISECONDS.sleep(config.bisqAppInitTime);
|
MILLISECONDS.sleep(config.bisqAppInitTime);
|
||||||
if (bisqProcess.hasStartupExceptions()) {
|
if (bisqProcess.hasStartupExceptions()) {
|
||||||
bisqProcess.logExceptions(bisqProcess.getStartupExceptions(), log);
|
bisqProcess.logExceptions(bisqProcess.getStartupExceptions(), log);
|
||||||
|
@ -326,9 +326,9 @@ public class Scaffold {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private HavenoProcess createBisqProcess(HavenoAppConfig bisqAppConfig)
|
private HavenoProcess createBisqProcess(HavenoAppConfig havenoAppConfig)
|
||||||
throws IOException, InterruptedException {
|
throws IOException, InterruptedException {
|
||||||
HavenoProcess bisqProcess = new HavenoProcess(bisqAppConfig, config);
|
HavenoProcess bisqProcess = new HavenoProcess(havenoAppConfig, config);
|
||||||
bisqProcess.verifyAppNotRunning();
|
bisqProcess.verifyAppNotRunning();
|
||||||
bisqProcess.verifyAppDataDirInstalled();
|
bisqProcess.verifyAppDataDirInstalled();
|
||||||
return bisqProcess;
|
return bisqProcess;
|
||||||
|
|
|
@ -118,7 +118,7 @@ public enum HavenoAppConfig {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "BisqAppConfig{" + "\n" +
|
return "HavenoAppConfig{" + "\n" +
|
||||||
" appName='" + appName + '\'' + "\n" +
|
" appName='" + appName + '\'' + "\n" +
|
||||||
", startupScript='" + startupScript + '\'' + "\n" +
|
", startupScript='" + startupScript + '\'' + "\n" +
|
||||||
", javaOpts='" + javaOpts + '\'' + "\n" +
|
", javaOpts='" + javaOpts + '\'' + "\n" +
|
||||||
|
|
|
@ -43,7 +43,7 @@ import bisq.daemon.app.HavenoDaemonMain;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess {
|
public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess {
|
||||||
|
|
||||||
private final HavenoAppConfig bisqAppConfig;
|
private final HavenoAppConfig havenoAppConfig;
|
||||||
private final String baseCurrencyNetwork;
|
private final String baseCurrencyNetwork;
|
||||||
private final String genesisTxId;
|
private final String genesisTxId;
|
||||||
private final int genesisBlockHeight;
|
private final int genesisBlockHeight;
|
||||||
|
@ -53,9 +53,9 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
||||||
private final String findBisqPidScript;
|
private final String findBisqPidScript;
|
||||||
private final String debugOpts;
|
private final String debugOpts;
|
||||||
|
|
||||||
public HavenoProcess(HavenoAppConfig bisqAppConfig, ApiTestConfig config) {
|
public HavenoProcess(HavenoAppConfig havenoAppConfig, ApiTestConfig config) {
|
||||||
super(bisqAppConfig.appName, config);
|
super(havenoAppConfig.appName, config);
|
||||||
this.bisqAppConfig = bisqAppConfig;
|
this.havenoAppConfig = havenoAppConfig;
|
||||||
this.baseCurrencyNetwork = "XMR_STAGENET";
|
this.baseCurrencyNetwork = "XMR_STAGENET";
|
||||||
this.genesisTxId = "30af0050040befd8af25068cc697e418e09c2d8ebd8d411d2240591b9ec203cf";
|
this.genesisTxId = "30af0050040befd8af25068cc697e418e09c2d8ebd8d411d2240591b9ec203cf";
|
||||||
this.genesisBlockHeight = 111;
|
this.genesisBlockHeight = 111;
|
||||||
|
@ -65,7 +65,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
||||||
this.findBisqPidScript = (config.isRunningTest ? "." : "./apitest")
|
this.findBisqPidScript = (config.isRunningTest ? "." : "./apitest")
|
||||||
+ "/scripts/get-bisq-pid.sh";
|
+ "/scripts/get-bisq-pid.sh";
|
||||||
this.debugOpts = config.enableBisqDebugging
|
this.debugOpts = config.enableBisqDebugging
|
||||||
? " -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:" + bisqAppConfig.remoteDebugPort
|
? " -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:" + havenoAppConfig.remoteDebugPort
|
||||||
: "";
|
: "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,33 +89,33 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
||||||
@Override
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
try {
|
try {
|
||||||
log.info("Shutting down {} ...", bisqAppConfig.appName);
|
log.info("Shutting down {} ...", havenoAppConfig.appName);
|
||||||
if (!isAlive(pid)) {
|
if (!isAlive(pid)) {
|
||||||
this.shutdownExceptions.add(new IllegalStateException(format("%s already shut down", bisqAppConfig.appName)));
|
this.shutdownExceptions.add(new IllegalStateException(format("%s already shut down", havenoAppConfig.appName)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String killCmd = "kill -15 " + pid;
|
String killCmd = "kill -15 " + pid;
|
||||||
if (new BashCommand(killCmd).run().getExitStatus() != 0) {
|
if (new BashCommand(killCmd).run().getExitStatus() != 0) {
|
||||||
this.shutdownExceptions.add(new IllegalStateException(format("Could not shut down %s", bisqAppConfig.appName)));
|
this.shutdownExceptions.add(new IllegalStateException(format("Could not shut down %s", havenoAppConfig.appName)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Be lenient about the time it takes for a java app to shut down.
|
// Be lenient about the time it takes for a java app to shut down.
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
if (!isAlive(pid)) {
|
if (!isAlive(pid)) {
|
||||||
log.info("{} stopped", bisqAppConfig.appName);
|
log.info("{} stopped", havenoAppConfig.appName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MILLISECONDS.sleep(2500);
|
MILLISECONDS.sleep(2500);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAlive(pid)) {
|
if (isAlive(pid)) {
|
||||||
this.shutdownExceptions.add(new IllegalStateException(format("%s shutdown did not work", bisqAppConfig.appName)));
|
this.shutdownExceptions.add(new IllegalStateException(format("%s shutdown did not work", havenoAppConfig.appName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.shutdownExceptions.add(new IllegalStateException(format("Error shutting down %s", bisqAppConfig.appName), e));
|
this.shutdownExceptions.add(new IllegalStateException(format("Error shutting down %s", havenoAppConfig.appName), e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,21 +123,21 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
||||||
long pid = findBisqAppPid();
|
long pid = findBisqAppPid();
|
||||||
if (pid >= 0)
|
if (pid >= 0)
|
||||||
throw new IllegalStateException(format("%s %s already running with pid %d",
|
throw new IllegalStateException(format("%s %s already running with pid %d",
|
||||||
bisqAppConfig.mainClassName, bisqAppConfig.appName, pid));
|
havenoAppConfig.mainClassName, havenoAppConfig.appName, pid));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void verifyAppDataDirInstalled() {
|
public void verifyAppDataDirInstalled() {
|
||||||
// If we're running an Alice or Bob daemon, make sure the dao-setup directory
|
// If we're running an Alice or Bob daemon, make sure the dao-setup directory
|
||||||
// are installed.
|
// are installed.
|
||||||
switch (bisqAppConfig) {
|
switch (havenoAppConfig) {
|
||||||
case alicedaemon:
|
case alicedaemon:
|
||||||
case alicedesktop:
|
case alicedesktop:
|
||||||
case bobdaemon:
|
case bobdaemon:
|
||||||
case bobdesktop:
|
case bobdesktop:
|
||||||
File bisqDataDir = new File(config.rootAppDataDir, bisqAppConfig.appName);
|
File bisqDataDir = new File(config.rootAppDataDir, havenoAppConfig.appName);
|
||||||
if (!bisqDataDir.exists())
|
if (!bisqDataDir.exists())
|
||||||
throw new IllegalStateException(format("Application dataDir %s/%s not found",
|
throw new IllegalStateException(format("Application dataDir %s/%s not found",
|
||||||
config.rootAppDataDir, bisqAppConfig.appName));
|
config.rootAppDataDir, havenoAppConfig.appName));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -152,7 +152,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
||||||
String classpath = System.getProperty("java.class.path");
|
String classpath = System.getProperty("java.class.path");
|
||||||
String bisqCmd = getJavaOptsSpec()
|
String bisqCmd = getJavaOptsSpec()
|
||||||
+ " " + java + " -cp " + classpath
|
+ " " + java + " -cp " + classpath
|
||||||
+ " " + bisqAppConfig.mainClassName
|
+ " " + havenoAppConfig.mainClassName
|
||||||
+ " " + String.join(" ", getOptsList())
|
+ " " + String.join(" ", getOptsList())
|
||||||
+ " &"; // run in background without nohup
|
+ " &"; // run in background without nohup
|
||||||
runBashCommand(bisqCmd);
|
runBashCommand(bisqCmd);
|
||||||
|
@ -163,7 +163,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
||||||
// are loaded from the root project's lib directory.
|
// are loaded from the root project's lib directory.
|
||||||
private void runStartupScript() throws IOException, InterruptedException {
|
private void runStartupScript() throws IOException, InterruptedException {
|
||||||
String startupScriptPath = config.rootProjectDir
|
String startupScriptPath = config.rootProjectDir
|
||||||
+ "/" + bisqAppConfig.startupScript;
|
+ "/" + havenoAppConfig.startupScript;
|
||||||
String bisqCmd = getJavaOptsSpec()
|
String bisqCmd = getJavaOptsSpec()
|
||||||
+ " " + startupScriptPath
|
+ " " + startupScriptPath
|
||||||
+ " " + String.join(" ", getOptsList())
|
+ " " + String.join(" ", getOptsList())
|
||||||
|
@ -173,15 +173,15 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
||||||
|
|
||||||
private void runBashCommand(String bisqCmd) throws IOException, InterruptedException {
|
private void runBashCommand(String bisqCmd) throws IOException, InterruptedException {
|
||||||
String cmdDescription = config.runSubprojectJars
|
String cmdDescription = config.runSubprojectJars
|
||||||
? "java -> " + bisqAppConfig.mainClassName + " -> " + bisqAppConfig.appName
|
? "java -> " + havenoAppConfig.mainClassName + " -> " + havenoAppConfig.appName
|
||||||
: bisqAppConfig.startupScript + " -> " + bisqAppConfig.appName;
|
: havenoAppConfig.startupScript + " -> " + havenoAppConfig.appName;
|
||||||
BashCommand bashCommand = new BashCommand(bisqCmd);
|
BashCommand bashCommand = new BashCommand(bisqCmd);
|
||||||
log.info("Starting {} ...\n$ {}", cmdDescription, bashCommand.getCommand());
|
log.info("Starting {} ...\n$ {}", cmdDescription, bashCommand.getCommand());
|
||||||
bashCommand.runInBackground();
|
bashCommand.runInBackground();
|
||||||
|
|
||||||
if (bashCommand.getExitStatus() != 0)
|
if (bashCommand.getExitStatus() != 0)
|
||||||
throw new IllegalStateException(format("Error starting BisqApp%n%s%nError: %s",
|
throw new IllegalStateException(format("Error starting BisqApp%n%s%nError: %s",
|
||||||
bisqAppConfig.appName,
|
havenoAppConfig.appName,
|
||||||
bashCommand.getError()));
|
bashCommand.getError()));
|
||||||
|
|
||||||
// Sometimes it takes a little extra time to find the linux process id.
|
// Sometimes it takes a little extra time to find the linux process id.
|
||||||
|
@ -197,26 +197,26 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
||||||
throw new IllegalStateException(format("Error finding pid for %s", this.name));
|
throw new IllegalStateException(format("Error finding pid for %s", this.name));
|
||||||
|
|
||||||
log.info("{} running with pid {}", cmdDescription, pid);
|
log.info("{} running with pid {}", cmdDescription, pid);
|
||||||
log.info("Log {}", config.rootAppDataDir + "/" + bisqAppConfig.appName + "/bisq.log");
|
log.info("Log {}", config.rootAppDataDir + "/" + havenoAppConfig.appName + "/bisq.log");
|
||||||
}
|
}
|
||||||
|
|
||||||
private long findBisqAppPid() throws IOException, InterruptedException {
|
private long findBisqAppPid() throws IOException, InterruptedException {
|
||||||
// Find the pid of the java process by grepping for the mainClassName and appName.
|
// Find the pid of the java process by grepping for the mainClassName and appName.
|
||||||
String findPidCmd = findBisqPidScript + " " + bisqAppConfig.mainClassName + " " + bisqAppConfig.appName;
|
String findPidCmd = findBisqPidScript + " " + havenoAppConfig.mainClassName + " " + havenoAppConfig.appName;
|
||||||
String psCmdOutput = new BashCommand(findPidCmd).run().getOutput();
|
String psCmdOutput = new BashCommand(findPidCmd).run().getOutput();
|
||||||
return (psCmdOutput == null || psCmdOutput.isEmpty()) ? -1 : Long.parseLong(psCmdOutput);
|
return (psCmdOutput == null || psCmdOutput.isEmpty()) ? -1 : Long.parseLong(psCmdOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getJavaOptsSpec() {
|
private String getJavaOptsSpec() {
|
||||||
return "export JAVA_OPTS=\"" + bisqAppConfig.javaOpts + debugOpts + "\"; ";
|
return "export JAVA_OPTS=\"" + havenoAppConfig.javaOpts + debugOpts + "\"; ";
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getOptsList() {
|
private List<String> getOptsList() {
|
||||||
return new ArrayList<>() {{
|
return new ArrayList<>() {{
|
||||||
add("--appName=" + bisqAppConfig.appName);
|
add("--appName=" + havenoAppConfig.appName);
|
||||||
add("--appDataDir=" + config.rootAppDataDir.getAbsolutePath() + "/" + bisqAppConfig.appName);
|
add("--appDataDir=" + config.rootAppDataDir.getAbsolutePath() + "/" + havenoAppConfig.appName);
|
||||||
add("--nodePort=" + bisqAppConfig.nodePort);
|
add("--nodePort=" + havenoAppConfig.nodePort);
|
||||||
add("--rpcBlockNotificationPort=" + bisqAppConfig.rpcBlockNotificationPort);
|
add("--rpcBlockNotificationPort=" + havenoAppConfig.rpcBlockNotificationPort);
|
||||||
add("--rpcUser=" + config.bitcoinRpcUser);
|
add("--rpcUser=" + config.bitcoinRpcUser);
|
||||||
add("--rpcPassword=" + config.bitcoinRpcPassword);
|
add("--rpcPassword=" + config.bitcoinRpcPassword);
|
||||||
add("--rpcPort=" + config.bitcoinRpcPort);
|
add("--rpcPort=" + config.bitcoinRpcPort);
|
||||||
|
@ -224,7 +224,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
||||||
add("--baseCurrencyNetwork=" + baseCurrencyNetwork);
|
add("--baseCurrencyNetwork=" + baseCurrencyNetwork);
|
||||||
add("--useDevPrivilegeKeys=" + useDevPrivilegeKeys);
|
add("--useDevPrivilegeKeys=" + useDevPrivilegeKeys);
|
||||||
add("--useLocalhostForP2P=" + useLocalhostForP2P);
|
add("--useLocalhostForP2P=" + useLocalhostForP2P);
|
||||||
switch (bisqAppConfig) {
|
switch (havenoAppConfig) {
|
||||||
case seednode:
|
case seednode:
|
||||||
break; // no extra opts needed for seed node
|
break; // no extra opts needed for seed node
|
||||||
case arbdaemon:
|
case arbdaemon:
|
||||||
|
@ -235,13 +235,13 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
||||||
case bobdesktop:
|
case bobdesktop:
|
||||||
add("--genesisBlockHeight=" + genesisBlockHeight);
|
add("--genesisBlockHeight=" + genesisBlockHeight);
|
||||||
add("--genesisTxId=" + genesisTxId);
|
add("--genesisTxId=" + genesisTxId);
|
||||||
if (bisqAppConfig.mainClassName.equals(HavenoDaemonMain.class.getName())) {
|
if (havenoAppConfig.mainClassName.equals(HavenoDaemonMain.class.getName())) {
|
||||||
add("--apiPassword=" + config.apiPassword);
|
add("--apiPassword=" + config.apiPassword);
|
||||||
add("--apiPort=" + bisqAppConfig.apiPort);
|
add("--apiPort=" + havenoAppConfig.apiPort);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException("Unknown BisqAppConfig " + bisqAppConfig.name());
|
throw new IllegalStateException("Unknown HavenoAppConfig " + havenoAppConfig.name());
|
||||||
}
|
}
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
@ -249,7 +249,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess
|
||||||
private File getJavaExecutable() {
|
private File getJavaExecutable() {
|
||||||
File javaHome = Paths.get(System.getProperty("java.home")).toFile();
|
File javaHome = Paths.get(System.getProperty("java.home")).toFile();
|
||||||
if (!javaHome.exists())
|
if (!javaHome.exists())
|
||||||
throw new IllegalStateException(format("$JAVA_HOME not found, cannot run %s", bisqAppConfig.mainClassName));
|
throw new IllegalStateException(format("$JAVA_HOME not found, cannot run %s", havenoAppConfig.mainClassName));
|
||||||
|
|
||||||
File javaExecutable = Paths.get(javaHome.getAbsolutePath(), "bin", "java").toFile();
|
File javaExecutable = Paths.get(javaHome.getAbsolutePath(), "bin", "java").toFile();
|
||||||
if (javaExecutable.exists() || javaExecutable.canExecute())
|
if (javaExecutable.exists() || javaExecutable.canExecute())
|
||||||
|
|
|
@ -67,7 +67,7 @@ import java.util.stream.Collectors;
|
||||||
/**
|
/**
|
||||||
* Handles the initialisation of domain classes. We should refactor to the model that the domain classes listen on the
|
* Handles the initialisation of domain classes. We should refactor to the model that the domain classes listen on the
|
||||||
* relevant start up state from AppStartupState instead to get called. Only for initialisation which has a required
|
* relevant start up state from AppStartupState instead to get called. Only for initialisation which has a required
|
||||||
* order we will still need this class. For now it helps to keep BisqSetup more focussed on the process and not getting
|
* order we will still need this class. For now it helps to keep HavenoSetup more focussed on the process and not getting
|
||||||
* overloaded with domain initialisation code.
|
* overloaded with domain initialisation code.
|
||||||
*/
|
*/
|
||||||
public class DomainInitialisation {
|
public class DomainInitialisation {
|
||||||
|
|
|
@ -54,7 +54,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public abstract class HavenoExecutable implements GracefulShutDownHandler, HavenoSetup.BisqSetupListener, UncaughtExceptionHandler {
|
public abstract class HavenoExecutable implements GracefulShutDownHandler, HavenoSetup.HavenoSetupListener, UncaughtExceptionHandler {
|
||||||
|
|
||||||
public static final int EXIT_SUCCESS = 0;
|
public static final int EXIT_SUCCESS = 0;
|
||||||
public static final int EXIT_FAILURE = 1;
|
public static final int EXIT_FAILURE = 1;
|
||||||
|
@ -139,7 +139,7 @@ public abstract class HavenoExecutable implements GracefulShutDownHandler, Haven
|
||||||
hasDowngraded = HavenoSetup.hasDowngraded();
|
hasDowngraded = HavenoSetup.hasDowngraded();
|
||||||
if (hasDowngraded) {
|
if (hasDowngraded) {
|
||||||
// If user tried to downgrade we do not read the persisted data to avoid data corruption
|
// If user tried to downgrade we do not read the persisted data to avoid data corruption
|
||||||
// We call startApplication to enable UI to show popup. We prevent in BisqSetup to go further
|
// We call startApplication to enable UI to show popup. We prevent in HavenoSetup to go further
|
||||||
// in the process and require a shut down.
|
// in the process and require a shut down.
|
||||||
startApplication();
|
startApplication();
|
||||||
} else {
|
} else {
|
||||||
|
@ -194,12 +194,12 @@ public abstract class HavenoExecutable implements GracefulShutDownHandler, Haven
|
||||||
|
|
||||||
// Once the application is ready we get that callback and we start the setup
|
// Once the application is ready we get that callback and we start the setup
|
||||||
protected void onApplicationStarted() {
|
protected void onApplicationStarted() {
|
||||||
runBisqSetup();
|
runHavenoSetup();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void runBisqSetup() {
|
protected void runHavenoSetup() {
|
||||||
HavenoSetup bisqSetup = injector.getInstance(HavenoSetup.class);
|
HavenoSetup bisqSetup = injector.getInstance(HavenoSetup.class);
|
||||||
bisqSetup.addBisqSetupListener(this);
|
bisqSetup.addHavenoSetupListener(this);
|
||||||
bisqSetup.start();
|
bisqSetup.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class HavenoHeadlessApp implements HeadlessApp {
|
||||||
public void startApplication() {
|
public void startApplication() {
|
||||||
try {
|
try {
|
||||||
bisqSetup = injector.getInstance(HavenoSetup.class);
|
bisqSetup = injector.getInstance(HavenoSetup.class);
|
||||||
bisqSetup.addBisqSetupListener(this);
|
bisqSetup.addHavenoSetupListener(this);
|
||||||
|
|
||||||
corruptedStorageFileHandler = injector.getInstance(CorruptedStorageFileHandler.class);
|
corruptedStorageFileHandler = injector.getInstance(CorruptedStorageFileHandler.class);
|
||||||
tradeManager = injector.getInstance(TradeManager.class);
|
tradeManager = injector.getInstance(TradeManager.class);
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class HavenoSetup {
|
||||||
private static final String VERSION_FILE_NAME = "version";
|
private static final String VERSION_FILE_NAME = "version";
|
||||||
private static final String RESYNC_SPV_FILE_NAME = "resyncSpv";
|
private static final String RESYNC_SPV_FILE_NAME = "resyncSpv";
|
||||||
|
|
||||||
public interface BisqSetupListener {
|
public interface HavenoSetupListener {
|
||||||
default void onInitP2pNetwork() {
|
default void onInitP2pNetwork() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ public class HavenoSetup {
|
||||||
private boolean allBasicServicesInitialized;
|
private boolean allBasicServicesInitialized;
|
||||||
@SuppressWarnings("FieldCanBeLocal")
|
@SuppressWarnings("FieldCanBeLocal")
|
||||||
private MonadicBinding<Boolean> p2pNetworkAndWalletInitialized;
|
private MonadicBinding<Boolean> p2pNetworkAndWalletInitialized;
|
||||||
private final List<BisqSetupListener> bisqSetupListeners = new ArrayList<>();
|
private final List<HavenoSetupListener> bisqSetupListeners = new ArrayList<>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public HavenoSetup(DomainInitialisation domainInitialisation,
|
public HavenoSetup(DomainInitialisation domainInitialisation,
|
||||||
|
@ -273,7 +273,7 @@ public class HavenoSetup {
|
||||||
// Main startup tasks
|
// Main startup tasks
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public void addBisqSetupListener(BisqSetupListener listener) {
|
public void addHavenoSetupListener(HavenoSetupListener listener) {
|
||||||
bisqSetupListeners.add(listener);
|
bisqSetupListeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ public class HavenoSetup {
|
||||||
private void step4() {
|
private void step4() {
|
||||||
initDomainServices();
|
initDomainServices();
|
||||||
|
|
||||||
bisqSetupListeners.forEach(BisqSetupListener::onSetupComplete);
|
bisqSetupListeners.forEach(HavenoSetupListener::onSetupComplete);
|
||||||
|
|
||||||
// We set that after calling the setupCompleteHandler to not trigger a popup from the dev dummy accounts
|
// We set that after calling the setupCompleteHandler to not trigger a popup from the dev dummy accounts
|
||||||
// in MainViewModel
|
// in MainViewModel
|
||||||
|
@ -373,7 +373,7 @@ public class HavenoSetup {
|
||||||
}, STARTUP_TIMEOUT_MINUTES, TimeUnit.MINUTES);
|
}, STARTUP_TIMEOUT_MINUTES, TimeUnit.MINUTES);
|
||||||
|
|
||||||
log.info("Init P2P network");
|
log.info("Init P2P network");
|
||||||
bisqSetupListeners.forEach(BisqSetupListener::onInitP2pNetwork);
|
bisqSetupListeners.forEach(HavenoSetupListener::onInitP2pNetwork);
|
||||||
p2pNetworkReady = p2PNetworkSetup.init(this::initWallet, displayTorNetworkSettingsHandler);
|
p2pNetworkReady = p2PNetworkSetup.init(this::initWallet, displayTorNetworkSettingsHandler);
|
||||||
|
|
||||||
// We only init wallet service here if not using Tor for bitcoinj.
|
// We only init wallet service here if not using Tor for bitcoinj.
|
||||||
|
@ -402,10 +402,10 @@ public class HavenoSetup {
|
||||||
|
|
||||||
private void initWallet() {
|
private void initWallet() {
|
||||||
log.info("Init wallet");
|
log.info("Init wallet");
|
||||||
bisqSetupListeners.forEach(BisqSetupListener::onInitWallet);
|
bisqSetupListeners.forEach(HavenoSetupListener::onInitWallet);
|
||||||
Runnable walletPasswordHandler = () -> {
|
Runnable walletPasswordHandler = () -> {
|
||||||
log.info("Wallet password required");
|
log.info("Wallet password required");
|
||||||
bisqSetupListeners.forEach(BisqSetupListener::onRequestWalletPassword);
|
bisqSetupListeners.forEach(HavenoSetupListener::onRequestWalletPassword);
|
||||||
if (p2pNetworkReady.get())
|
if (p2pNetworkReady.get())
|
||||||
p2PNetworkSetup.setSplashP2PNetworkAnimationVisible(true);
|
p2PNetworkSetup.setSplashP2PNetworkAnimationVisible(true);
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import bisq.common.setup.UncaughtExceptionHandler;
|
||||||
|
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
|
|
||||||
public interface HeadlessApp extends UncaughtExceptionHandler, HavenoSetup.BisqSetupListener {
|
public interface HeadlessApp extends UncaughtExceptionHandler, HavenoSetup.HavenoSetupListener {
|
||||||
void setGracefulShutDownHandler(GracefulShutDownHandler gracefulShutDownHandler);
|
void setGracefulShutDownHandler(GracefulShutDownHandler gracefulShutDownHandler);
|
||||||
|
|
||||||
void setInjector(Injector injector);
|
void setInjector(Injector injector);
|
||||||
|
|
|
@ -37,7 +37,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import bisq.daemon.grpc.GrpcServer;
|
import bisq.daemon.grpc.GrpcServer;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class HavenoDaemonMain extends HavenoHeadlessAppMain implements HavenoSetup.BisqSetupListener {
|
public class HavenoDaemonMain extends HavenoHeadlessAppMain implements HavenoSetup.HavenoSetupListener {
|
||||||
|
|
||||||
private GrpcServer grpcServer;
|
private GrpcServer grpcServer;
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class MainViewModel implements ViewModel, HavenoSetup.BisqSetupListener {
|
public class MainViewModel implements ViewModel, HavenoSetup.HavenoSetupListener {
|
||||||
private final HavenoSetup bisqSetup;
|
private final HavenoSetup bisqSetup;
|
||||||
private final WalletsSetup walletsSetup;
|
private final WalletsSetup walletsSetup;
|
||||||
private final User user;
|
private final User user;
|
||||||
|
@ -209,12 +209,12 @@ public class MainViewModel implements ViewModel, HavenoSetup.BisqSetupListener {
|
||||||
GUIUtil.setPreferences(preferences);
|
GUIUtil.setPreferences(preferences);
|
||||||
|
|
||||||
setupHandlers();
|
setupHandlers();
|
||||||
bisqSetup.addBisqSetupListener(this);
|
bisqSetup.addHavenoSetupListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// BisqSetupListener
|
// HavenoSetupListener
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<?import bisq.desktop.components.AutoTooltipCheckBox?>
|
<?import bisq.desktop.components.AutoTooltipCheckBox?>
|
||||||
<?import bisq.desktop.components.AutoTooltipLabel?>
|
<?import bisq.desktop.components.AutoTooltipLabel?>
|
||||||
<?import bisq.desktop.components.AutoTooltipRadioButton?>
|
<?import bisq.desktop.components.AutoTooltipRadioButton?>
|
||||||
<?import bisq.desktop.components.BisqTextField?>
|
<?import bisq.desktop.components.HavenoTextField?>
|
||||||
<?import bisq.desktop.components.InputTextField?>
|
<?import bisq.desktop.components.InputTextField?>
|
||||||
<?import bisq.desktop.components.TitledGroupBg?>
|
<?import bisq.desktop.components.TitledGroupBg?>
|
||||||
<?import javafx.scene.control.cell.PropertyValueFactory?>
|
<?import javafx.scene.control.cell.PropertyValueFactory?>
|
||||||
|
@ -103,12 +103,12 @@
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</TitledGroupBg>
|
</TitledGroupBg>
|
||||||
|
|
||||||
<BisqTextField fx:id="onionAddress" GridPane.rowIndex="5"
|
<HavenoTextField fx:id="onionAddress" GridPane.rowIndex="5"
|
||||||
editable="false" focusTraversable="false" labelFloat="true">
|
editable="false" focusTraversable="false" labelFloat="true">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets top="60.0"/>
|
<Insets top="60.0"/>
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</BisqTextField>
|
</HavenoTextField>
|
||||||
|
|
||||||
<VBox GridPane.rowIndex="6" GridPane.hgrow="ALWAYS" GridPane.vgrow="SOMETIMES">
|
<VBox GridPane.rowIndex="6" GridPane.hgrow="ALWAYS" GridPane.vgrow="SOMETIMES">
|
||||||
<AutoTooltipLabel fx:id="p2PPeersLabel" styleClass="small-text"/>
|
<AutoTooltipLabel fx:id="p2PPeersLabel" styleClass="small-text"/>
|
||||||
|
@ -153,13 +153,13 @@
|
||||||
</TableView>
|
</TableView>
|
||||||
</VBox>
|
</VBox>
|
||||||
|
|
||||||
<BisqTextField fx:id="sentDataTextField" GridPane.rowIndex="7" editable="false"
|
<HavenoTextField fx:id="sentDataTextField" GridPane.rowIndex="7" editable="false"
|
||||||
focusTraversable="false" labelFloat="true"/>
|
focusTraversable="false" labelFloat="true"/>
|
||||||
|
|
||||||
<BisqTextField fx:id="receivedDataTextField" GridPane.rowIndex="8" editable="false"
|
<HavenoTextField fx:id="receivedDataTextField" GridPane.rowIndex="8" editable="false"
|
||||||
focusTraversable="false" labelFloat="true"/>
|
focusTraversable="false" labelFloat="true"/>
|
||||||
|
|
||||||
<BisqTextField fx:id="chainHeightTextField" GridPane.rowIndex="9" editable="false"
|
<HavenoTextField fx:id="chainHeightTextField" GridPane.rowIndex="9" editable="false"
|
||||||
focusTraversable="false" labelFloat="true"/>
|
focusTraversable="false" labelFloat="true"/>
|
||||||
|
|
||||||
<AutoTooltipButton fx:id="openTorSettingsButton" GridPane.rowIndex="10" GridPane.columnIndex="0"/>
|
<AutoTooltipButton fx:id="openTorSettingsButton" GridPane.rowIndex="10" GridPane.columnIndex="0"/>
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class GuiceSetupTest {
|
||||||
assertSingleton(DisplayedTransactionsFactory.class);
|
assertSingleton(DisplayedTransactionsFactory.class);
|
||||||
|
|
||||||
// core module
|
// core module
|
||||||
// assertSingleton(BisqSetup.class); // this is a can of worms
|
// assertSingleton(HavenoSetup.class); // this is a can of worms
|
||||||
// assertSingleton(DisputeMsgEvents.class);
|
// assertSingleton(DisputeMsgEvents.class);
|
||||||
assertSingleton(TorSetup.class);
|
assertSingleton(TorSetup.class);
|
||||||
assertSingleton(P2PNetworkSetup.class);
|
assertSingleton(P2PNetworkSetup.class);
|
||||||
|
|
Loading…
Reference in a new issue