mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-25 16:05:28 -04:00
support --ignoreLocalXmrNode startup flag
This commit is contained in:
parent
416761af41
commit
3cdd88b569
3 changed files with 18 additions and 3 deletions
|
@ -238,7 +238,9 @@ public final class XmrConnectionService {
|
|||
|
||||
public MoneroRpcConnection getBestAvailableConnection() {
|
||||
accountService.checkAccountOpen();
|
||||
return connectionManager.getBestAvailableConnection();
|
||||
List<MoneroRpcConnection> ignoredConnections = new ArrayList<MoneroRpcConnection>();
|
||||
if (xmrLocalNode.shouldBeIgnored() && connectionManager.hasConnection(xmrLocalNode.getUri())) ignoredConnections.add(connectionManager.getConnectionByUri(xmrLocalNode.getUri()));
|
||||
return connectionManager.getBestAvailableConnection(ignoredConnections.toArray(new MoneroRpcConnection[0]));
|
||||
}
|
||||
|
||||
public void setAutoSwitch(boolean autoSwitch) {
|
||||
|
@ -458,7 +460,9 @@ public final class XmrConnectionService {
|
|||
|
||||
// restore last connection
|
||||
if (connectionList.getCurrentConnectionUri().isPresent() && connectionManager.hasConnection(connectionList.getCurrentConnectionUri().get())) {
|
||||
connectionManager.setConnection(connectionList.getCurrentConnectionUri().get());
|
||||
if (!HavenoUtils.isLocalHost(connectionList.getCurrentConnectionUri().get()) || !xmrLocalNode.shouldBeIgnored()) {
|
||||
connectionManager.setConnection(connectionList.getCurrentConnectionUri().get());
|
||||
}
|
||||
}
|
||||
|
||||
// set connection proxies
|
||||
|
|
|
@ -81,7 +81,7 @@ public class XmrLocalNode {
|
|||
public XmrLocalNode(Config config, Preferences preferences) {
|
||||
this.config = config;
|
||||
this.preferences = preferences;
|
||||
this.daemon = new MoneroDaemonRpc("http://" + HavenoUtils.LOOPBACK_HOST + ":" + rpcPort);
|
||||
this.daemon = new MoneroDaemonRpc(getUri());
|
||||
|
||||
// initialize connection manager to listen to local connection
|
||||
this.connectionManager = new MoneroConnectionManager().setConnection(daemon.getRpcConnection());
|
||||
|
@ -92,6 +92,10 @@ public class XmrLocalNode {
|
|||
this.connectionManager.startPolling(REFRESH_PERIOD_LOCAL_MS);
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return "http://" + HavenoUtils.LOOPBACK_HOST + ":" + rpcPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether Haveno should use a local Monero node, meaning that a node was
|
||||
* detected and conditions under which it should be ignored have not been met. If
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue