Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce inclusion of TradeLimits for headless apps #5857

Merged
merged 2 commits into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions core/src/main/java/bisq/core/app/BisqHeadlessAppMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package bisq.core.app;

import bisq.core.payment.TradeLimits;

import bisq.common.UserThread;
import bisq.common.app.AppModule;
import bisq.common.app.Version;
Expand All @@ -31,6 +33,7 @@
@Slf4j
public class BisqHeadlessAppMain extends BisqExecutable {
protected HeadlessApp headlessApp;
private TradeLimits tradeLimits;

public BisqHeadlessAppMain() {
super("Bisq Daemon", "bisqd", "Bisq", Version.VERSION);
Expand Down Expand Up @@ -108,6 +111,9 @@ protected void applyInjector() {

@Override
protected void startApplication() {
// Pin that as it is used in PaymentMethods and verification in TradeStatistics
tradeLimits = injector.getInstance(TradeLimits.class);

// We need to be in user thread! We mapped at launchApplication already...
headlessApp.startApplication();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import bisq.core.dao.node.full.RpcService;
import bisq.core.offer.OpenOfferManager;
import bisq.core.offer.bsq_swap.OpenBsqSwapOfferService;
import bisq.core.payment.TradeLimits;
import bisq.core.support.dispute.arbitration.arbitrator.ArbitratorManager;

import bisq.network.p2p.NodeAddress;
Expand Down Expand Up @@ -62,6 +63,7 @@ public abstract class ExecutableForAppWithP2p extends BisqExecutable {
private static final long SHUTDOWN_INTERVAL = TimeUnit.HOURS.toMillis(24);
private volatile boolean stopped;
private final long startTime = System.currentTimeMillis();
private TradeLimits tradeLimits;

public ExecutableForAppWithP2p(String fullName, String scriptName, String appName, String version) {
super(fullName, scriptName, appName, version);
Expand All @@ -76,6 +78,12 @@ protected void configUserThread() {
UserThread.setExecutor(Executors.newSingleThreadExecutor(threadFactory));
}

@Override
protected void startApplication() {
// Pin that as it is used in PaymentMethods and verification in TradeStatistics
tradeLimits = injector.getInstance(TradeLimits.class);
}

@Override
public void onSetupComplete() {
log.info("onSetupComplete");
Expand Down
7 changes: 1 addition & 6 deletions daemon/src/main/java/bisq/daemon/app/BisqDaemonMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,7 @@ protected void applyInjector() {

@Override
protected void startApplication() {
// We need to be in user thread! We mapped at launchApplication already...
headlessApp.startApplication();

// In headless mode we don't have an async behaviour so we trigger the setup by
// calling onApplicationStarted.
onApplicationStarted();
super.startApplication();
}

@Override
Expand Down
2 changes: 2 additions & 0 deletions seednode/src/main/java/bisq/seednode/SeedNodeMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ private int getMyIndex() {

@Override
protected void startApplication() {
super.startApplication();

Cookie cookie = injector.getInstance(User.class).getCookie();
cookie.getAsOptionalBoolean(CookieKey.CLEAN_TOR_DIR_AT_RESTART).ifPresent(wasCleanTorDirSet -> {
if (wasCleanTorDirSet) {
Expand Down
2 changes: 2 additions & 0 deletions statsnode/src/main/java/bisq/statistics/StatisticsMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ protected void applyInjector() {

@Override
protected void startApplication() {
super.startApplication();

statistics.startApplication();
}
}