mirror of
https://github.com/boldsuck/haveno.git
synced 2025-02-28 05:40:18 +00:00
Merge branch 'haveno-dex:master' into haveno-reto
This commit is contained in:
commit
8523fb97d1
11 changed files with 55 additions and 44 deletions
.github/workflows
common/src/main/java/haveno/common/config
core/src/main/java/haveno/core
daemon/src/main/java/haveno/daemon/grpc
desktop/src/main/java/haveno/desktop
proto/src/main/proto
21
.github/workflows/build.yml
vendored
21
.github/workflows/build.yml
vendored
|
@ -26,22 +26,23 @@ jobs:
|
|||
cache: gradle
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build --stacktrace --scan
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: failure()
|
||||
with:
|
||||
name: error-reports-${{ matrix.os }}
|
||||
path: ${{ github.workspace }}/desktop/build/reports
|
||||
- name: cache nodes dependencies
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
include-hidden-files: true
|
||||
name: cached-localnet
|
||||
path: .localnet
|
||||
overwrite: true
|
||||
- name: Install dependencies
|
||||
if: ${{ matrix.os == 'ubuntu-22.04' }}
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y rpm libfuse2 flatpak flatpak-builder appstream
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y rpm libfuse2 flatpak flatpak-builder appstream
|
||||
flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
- name: Install WiX Toolset
|
||||
if: ${{ matrix.os == 'windows-latest' }}
|
||||
|
@ -99,41 +100,41 @@ jobs:
|
|||
shell: powershell
|
||||
|
||||
# win
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
name: "Windows artifacts"
|
||||
if: ${{ matrix.os == 'windows-latest'}}
|
||||
with:
|
||||
name: haveno-windows
|
||||
path: ${{ github.workspace }}/release-windows
|
||||
# macos
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
name: "macOS artifacts"
|
||||
if: ${{ matrix.os == 'macos-13' }}
|
||||
with:
|
||||
name: haveno-macos
|
||||
path: ${{ github.workspace }}/release-macos
|
||||
# linux
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
name: "Linux - deb artifact"
|
||||
if: ${{ matrix.os == 'ubuntu-22.04' }}
|
||||
with:
|
||||
name: haveno-linux-deb
|
||||
path: ${{ github.workspace }}/release-linux-deb
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
name: "Linux - rpm artifact"
|
||||
if: ${{ matrix.os == 'ubuntu-22.04' }}
|
||||
with:
|
||||
name: haveno-linux-rpm
|
||||
path: ${{ github.workspace }}/release-linux-rpm
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
name: "Linux - AppImage artifact"
|
||||
if: ${{ matrix.os == 'ubuntu-22.04' }}
|
||||
with:
|
||||
name: haveno-linux-appimage
|
||||
path: ${{ github.workspace }}/release-linux-appimage
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
name: "Linux - flatpak artifact"
|
||||
if: ${{ matrix.os == 'ubuntu-22.04' }}
|
||||
with:
|
||||
|
|
2
.github/workflows/codacy-code-reporter.yml
vendored
2
.github/workflows/codacy-code-reporter.yml
vendored
|
@ -9,7 +9,7 @@ jobs:
|
|||
build:
|
||||
if: github.repository == 'haveno-dex/haveno'
|
||||
name: Publish coverage
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
|
2
.github/workflows/label.yml
vendored
2
.github/workflows/label.yml
vendored
|
@ -7,7 +7,7 @@ on:
|
|||
|
||||
jobs:
|
||||
issueLabeled:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Bounty explanation
|
||||
uses: peter-evans/create-or-update-comment@v3
|
||||
|
|
|
@ -117,6 +117,7 @@ public class Config {
|
|||
public static final String BTC_FEE_INFO = "bitcoinFeeInfo";
|
||||
public static final String BYPASS_MEMPOOL_VALIDATION = "bypassMempoolValidation";
|
||||
public static final String PASSWORD_REQUIRED = "passwordRequired";
|
||||
public static final String UPDATE_XMR_BINARIES = "updateXmrBinaries";
|
||||
|
||||
// Default values for certain options
|
||||
public static final int UNSPECIFIED_PORT = -1;
|
||||
|
@ -204,6 +205,7 @@ public class Config {
|
|||
public final boolean republishMailboxEntries;
|
||||
public final boolean bypassMempoolValidation;
|
||||
public final boolean passwordRequired;
|
||||
public final boolean updateXmrBinaries;
|
||||
|
||||
// Properties derived from options but not exposed as options themselves
|
||||
public final File torDir;
|
||||
|
@ -621,6 +623,13 @@ public class Config {
|
|||
.ofType(boolean.class)
|
||||
.defaultsTo(false);
|
||||
|
||||
ArgumentAcceptingOptionSpec<Boolean> updateXmrBinariesOpt =
|
||||
parser.accepts(UPDATE_XMR_BINARIES,
|
||||
"Update Monero binaries if applicable")
|
||||
.withRequiredArg()
|
||||
.ofType(boolean.class)
|
||||
.defaultsTo(true);
|
||||
|
||||
try {
|
||||
CompositeOptionSet options = new CompositeOptionSet();
|
||||
|
||||
|
@ -733,6 +742,7 @@ public class Config {
|
|||
this.republishMailboxEntries = options.valueOf(republishMailboxEntriesOpt);
|
||||
this.bypassMempoolValidation = options.valueOf(bypassMempoolValidationOpt);
|
||||
this.passwordRequired = options.valueOf(passwordRequiredOpt);
|
||||
this.updateXmrBinaries = options.valueOf(updateXmrBinariesOpt);
|
||||
} catch (OptionException ex) {
|
||||
throw new ConfigException("problem parsing option '%s': %s",
|
||||
ex.options().get(0),
|
||||
|
|
|
@ -239,8 +239,8 @@ public class CoreApi {
|
|||
xmrConnectionService.stopCheckingConnection();
|
||||
}
|
||||
|
||||
public MoneroRpcConnection getBestAvailableXmrConnection() {
|
||||
return xmrConnectionService.getBestAvailableConnection();
|
||||
public MoneroRpcConnection getBestXmrConnection() {
|
||||
return xmrConnectionService.getBestConnection();
|
||||
}
|
||||
|
||||
public void setXmrConnectionAutoSwitch(boolean autoSwitch) {
|
||||
|
|
|
@ -255,18 +255,17 @@ public final class XmrConnectionService {
|
|||
updatePolling();
|
||||
}
|
||||
|
||||
public MoneroRpcConnection getBestAvailableConnection() {
|
||||
accountService.checkAccountOpen();
|
||||
List<MoneroRpcConnection> ignoredConnections = new ArrayList<MoneroRpcConnection>();
|
||||
addLocalNodeIfIgnored(ignoredConnections);
|
||||
return connectionManager.getBestAvailableConnection(ignoredConnections.toArray(new MoneroRpcConnection[0]));
|
||||
public MoneroRpcConnection getBestConnection() {
|
||||
return getBestConnection(new ArrayList<MoneroRpcConnection>());
|
||||
}
|
||||
|
||||
private MoneroRpcConnection getBestAvailableConnection(Collection<MoneroRpcConnection> ignoredConnections) {
|
||||
private MoneroRpcConnection getBestConnection(Collection<MoneroRpcConnection> ignoredConnections) {
|
||||
accountService.checkAccountOpen();
|
||||
Set<MoneroRpcConnection> ignoredConnectionsSet = new HashSet<>(ignoredConnections);
|
||||
addLocalNodeIfIgnored(ignoredConnectionsSet);
|
||||
return connectionManager.getBestAvailableConnection(ignoredConnectionsSet.toArray(new MoneroRpcConnection[0]));
|
||||
MoneroRpcConnection bestConnection = connectionManager.getBestAvailableConnection(ignoredConnectionsSet.toArray(new MoneroRpcConnection[0])); // checks connections
|
||||
if (bestConnection == null && connectionManager.getConnections().size() == 1 && !ignoredConnectionsSet.contains(connectionManager.getConnections().get(0))) bestConnection = connectionManager.getConnections().get(0);
|
||||
return bestConnection;
|
||||
}
|
||||
|
||||
private void addLocalNodeIfIgnored(Collection<MoneroRpcConnection> ignoredConnections) {
|
||||
|
@ -278,7 +277,7 @@ public final class XmrConnectionService {
|
|||
log.info("Skipping switch to best Monero connection because connection is fixed or auto switch is disabled");
|
||||
return;
|
||||
}
|
||||
MoneroRpcConnection bestConnection = getBestAvailableConnection();
|
||||
MoneroRpcConnection bestConnection = getBestConnection();
|
||||
if (bestConnection != null) setConnection(bestConnection);
|
||||
}
|
||||
|
||||
|
@ -329,7 +328,7 @@ public final class XmrConnectionService {
|
|||
if (currentConnection != null) excludedConnections.add(currentConnection);
|
||||
|
||||
// get connection to switch to
|
||||
MoneroRpcConnection bestConnection = getBestAvailableConnection(excludedConnections);
|
||||
MoneroRpcConnection bestConnection = getBestConnection(excludedConnections);
|
||||
|
||||
// remove from excluded connections after period
|
||||
UserThread.runAfter(() -> {
|
||||
|
@ -337,7 +336,7 @@ public final class XmrConnectionService {
|
|||
}, EXCLUDE_CONNECTION_SECONDS);
|
||||
|
||||
// return if no connection to switch to
|
||||
if (bestConnection == null) {
|
||||
if (bestConnection == null || !Boolean.TRUE.equals(bestConnection.isConnected())) {
|
||||
log.warn("No connection to switch to");
|
||||
return false;
|
||||
}
|
||||
|
@ -545,7 +544,7 @@ public final class XmrConnectionService {
|
|||
if (isConnected) {
|
||||
setConnection(connection.getUri());
|
||||
} else if (getConnection() != null && getConnection().getUri().equals(connection.getUri())) {
|
||||
MoneroRpcConnection bestConnection = getBestAvailableConnection();
|
||||
MoneroRpcConnection bestConnection = getBestConnection();
|
||||
if (bestConnection != null) setConnection(bestConnection); // switch to best connection
|
||||
}
|
||||
}
|
||||
|
@ -610,7 +609,7 @@ public final class XmrConnectionService {
|
|||
|
||||
// update connection
|
||||
if (connectionManager.getConnection() == null || connectionManager.getAutoSwitch()) {
|
||||
MoneroRpcConnection bestConnection = getBestAvailableConnection();
|
||||
MoneroRpcConnection bestConnection = getBestConnection();
|
||||
if (bestConnection != null) setConnection(bestConnection);
|
||||
}
|
||||
} else if (!isInitialized) {
|
||||
|
@ -725,8 +724,8 @@ public final class XmrConnectionService {
|
|||
|
||||
// poll daemon
|
||||
if (daemon == null) switchToBestConnection();
|
||||
if (daemon == null) throw new RuntimeException("No connection to Monero daemon");
|
||||
try {
|
||||
if (daemon == null) throw new RuntimeException("No connection to Monero daemon");
|
||||
lastInfo = daemon.getInfo();
|
||||
} catch (Exception e) {
|
||||
|
||||
|
@ -753,6 +752,7 @@ public final class XmrConnectionService {
|
|||
|
||||
// switch to best connection
|
||||
switchToBestConnection();
|
||||
if (daemon == null) throw new RuntimeException("No connection to Monero daemon after error handling");
|
||||
lastInfo = daemon.getInfo(); // caught internally if still fails
|
||||
}
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ public class HavenoSetup {
|
|||
// install monerod
|
||||
File monerodFile = new File(XmrLocalNode.MONEROD_PATH);
|
||||
String monerodResourcePath = "bin/" + XmrLocalNode.MONEROD_NAME;
|
||||
if (!monerodFile.exists() || !FileUtil.resourceEqualToFile(monerodResourcePath, monerodFile)) {
|
||||
if (!monerodFile.exists() || (config.updateXmrBinaries && !FileUtil.resourceEqualToFile(monerodResourcePath, monerodFile))) {
|
||||
log.info("Installing monerod");
|
||||
monerodFile.getParentFile().mkdirs();
|
||||
FileUtil.resourceToFile("bin/" + XmrLocalNode.MONEROD_NAME, monerodFile);
|
||||
|
@ -379,7 +379,7 @@ public class HavenoSetup {
|
|||
// install monero-wallet-rpc
|
||||
File moneroWalletRpcFile = new File(XmrWalletService.MONERO_WALLET_RPC_PATH);
|
||||
String moneroWalletRpcResourcePath = "bin/" + XmrWalletService.MONERO_WALLET_RPC_NAME;
|
||||
if (!moneroWalletRpcFile.exists() || !FileUtil.resourceEqualToFile(moneroWalletRpcResourcePath, moneroWalletRpcFile)) {
|
||||
if (!moneroWalletRpcFile.exists() || (config.updateXmrBinaries && !FileUtil.resourceEqualToFile(moneroWalletRpcResourcePath, moneroWalletRpcFile))) {
|
||||
log.info("Installing monero-wallet-rpc");
|
||||
moneroWalletRpcFile.getParentFile().mkdirs();
|
||||
FileUtil.resourceToFile(moneroWalletRpcResourcePath, moneroWalletRpcFile);
|
||||
|
|
|
@ -47,8 +47,8 @@ import haveno.proto.grpc.CheckConnectionsReply;
|
|||
import haveno.proto.grpc.CheckConnectionsRequest;
|
||||
import haveno.proto.grpc.GetAutoSwitchReply;
|
||||
import haveno.proto.grpc.GetAutoSwitchRequest;
|
||||
import haveno.proto.grpc.GetBestAvailableConnectionReply;
|
||||
import haveno.proto.grpc.GetBestAvailableConnectionRequest;
|
||||
import haveno.proto.grpc.GetBestConnectionReply;
|
||||
import haveno.proto.grpc.GetBestConnectionRequest;
|
||||
import haveno.proto.grpc.GetConnectionReply;
|
||||
import haveno.proto.grpc.GetConnectionRequest;
|
||||
import haveno.proto.grpc.GetConnectionsReply;
|
||||
|
@ -68,7 +68,7 @@ import static haveno.proto.grpc.XmrConnectionsGrpc.XmrConnectionsImplBase;
|
|||
import static haveno.proto.grpc.XmrConnectionsGrpc.getAddConnectionMethod;
|
||||
import static haveno.proto.grpc.XmrConnectionsGrpc.getCheckConnectionMethod;
|
||||
import static haveno.proto.grpc.XmrConnectionsGrpc.getCheckConnectionsMethod;
|
||||
import static haveno.proto.grpc.XmrConnectionsGrpc.getGetBestAvailableConnectionMethod;
|
||||
import static haveno.proto.grpc.XmrConnectionsGrpc.getGetBestConnectionMethod;
|
||||
import static haveno.proto.grpc.XmrConnectionsGrpc.getGetConnectionMethod;
|
||||
import static haveno.proto.grpc.XmrConnectionsGrpc.getGetConnectionsMethod;
|
||||
import static haveno.proto.grpc.XmrConnectionsGrpc.getRemoveConnectionMethod;
|
||||
|
@ -201,12 +201,12 @@ class GrpcXmrConnectionService extends XmrConnectionsImplBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getBestAvailableConnection(GetBestAvailableConnectionRequest request,
|
||||
StreamObserver<GetBestAvailableConnectionReply> responseObserver) {
|
||||
public void getBestConnection(GetBestConnectionRequest request,
|
||||
StreamObserver<GetBestConnectionReply> responseObserver) {
|
||||
handleRequest(responseObserver, () -> {
|
||||
MoneroRpcConnection connection = coreApi.getBestAvailableXmrConnection();
|
||||
MoneroRpcConnection connection = coreApi.getBestXmrConnection();
|
||||
UrlConnection replyConnection = toUrlConnection(connection);
|
||||
GetBestAvailableConnectionReply.Builder builder = GetBestAvailableConnectionReply.newBuilder();
|
||||
GetBestConnectionReply.Builder builder = GetBestConnectionReply.newBuilder();
|
||||
if (replyConnection != null) {
|
||||
builder.setConnection(replyConnection);
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ class GrpcXmrConnectionService extends XmrConnectionsImplBase {
|
|||
put(getCheckConnectionsMethod().getFullMethodName(), new GrpcCallRateMeter(allowedCallsPerTimeWindow, SECONDS));
|
||||
put(getStartCheckingConnectionMethod().getFullMethodName(), new GrpcCallRateMeter(allowedCallsPerTimeWindow, SECONDS));
|
||||
put(getStopCheckingConnectionMethod().getFullMethodName(), new GrpcCallRateMeter(allowedCallsPerTimeWindow, SECONDS));
|
||||
put(getGetBestAvailableConnectionMethod().getFullMethodName(), new GrpcCallRateMeter(allowedCallsPerTimeWindow, SECONDS));
|
||||
put(getGetBestConnectionMethod().getFullMethodName(), new GrpcCallRateMeter(allowedCallsPerTimeWindow, SECONDS));
|
||||
put(getSetAutoSwitchMethod().getFullMethodName(), new GrpcCallRateMeter(allowedCallsPerTimeWindow, SECONDS));
|
||||
}}
|
||||
)));
|
||||
|
|
|
@ -216,7 +216,7 @@ public class HavenoAppMain extends HavenoExecutable {
|
|||
|
||||
// Set the dialog content
|
||||
VBox vbox = new VBox(10);
|
||||
vbox.getChildren().addAll(new ImageView(ImageUtil.getImageByPath("logo_splash.png")), versionField, passwordField, errorMessageField);
|
||||
vbox.getChildren().addAll(new ImageView(ImageUtil.getImageByPath("logo_splash.png")), passwordField, errorMessageField, versionField);
|
||||
vbox.setAlignment(Pos.TOP_CENTER);
|
||||
getDialogPane().setContent(vbox);
|
||||
|
||||
|
|
|
@ -511,8 +511,6 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
ImageView logo = new ImageView();
|
||||
logo.setId(Config.baseCurrencyNetwork() == BaseCurrencyNetwork.XMR_MAINNET ? "image-splash-logo" : "image-splash-testnet-logo");
|
||||
|
||||
Label versionLabel = new Label("v" + Version.VERSION);
|
||||
|
||||
// createBitcoinInfoBox
|
||||
xmrSplashInfo = new AutoTooltipLabel();
|
||||
xmrSplashInfo.textProperty().bind(model.getXmrInfo());
|
||||
|
@ -624,7 +622,9 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
splashP2PNetworkBox.setPrefHeight(40);
|
||||
splashP2PNetworkBox.getChildren().addAll(splashP2PNetworkLabel, splashP2PNetworkBusyAnimation, splashP2PNetworkIcon, showTorNetworkSettingsButton);
|
||||
|
||||
vBox.getChildren().addAll(logo, versionLabel, blockchainSyncBox, xmrSyncIndicator, splashP2PNetworkBox);
|
||||
Label versionLabel = new Label("v" + Version.VERSION);
|
||||
|
||||
vBox.getChildren().addAll(logo, blockchainSyncBox, xmrSyncIndicator, splashP2PNetworkBox, versionLabel);
|
||||
return vBox;
|
||||
}
|
||||
|
||||
|
|
|
@ -319,7 +319,7 @@ service XmrConnections {
|
|||
}
|
||||
rpc StopCheckingConnection(StopCheckingConnectionRequest) returns (StopCheckingConnectionReply) {
|
||||
}
|
||||
rpc GetBestAvailableConnection(GetBestAvailableConnectionRequest) returns (GetBestAvailableConnectionReply) {
|
||||
rpc GetBestConnection(GetBestConnectionRequest) returns (GetBestConnectionReply) {
|
||||
}
|
||||
rpc SetAutoSwitch(SetAutoSwitchRequest) returns (SetAutoSwitchReply) {
|
||||
}
|
||||
|
@ -400,9 +400,9 @@ message StopCheckingConnectionRequest {}
|
|||
|
||||
message StopCheckingConnectionReply {}
|
||||
|
||||
message GetBestAvailableConnectionRequest {}
|
||||
message GetBestConnectionRequest {}
|
||||
|
||||
message GetBestAvailableConnectionReply {
|
||||
message GetBestConnectionReply {
|
||||
UrlConnection connection = 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue