mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-22 14:42:37 +01:00
Merge branch 'Development' into dao
This commit is contained in:
commit
b4d01ade87
21 changed files with 193 additions and 87 deletions
|
@ -29,7 +29,7 @@ public class Version {
|
|||
// VERSION = 0.5.0 introduces proto buffer for the P2P network and local DB and is a not backward compatible update
|
||||
// Therefore all sub versions start again with 1
|
||||
// We use semantic versioning with major, minor and patch
|
||||
public static final String VERSION = "0.6.1";
|
||||
public static final String VERSION = "0.6.1";
|
||||
|
||||
public static int getMajorVersion(String version) {
|
||||
return getSubVersion(version, 0);
|
||||
|
|
|
@ -246,6 +246,7 @@ mainView.walletServiceErrorMsg.timeout=Connecting to the bitcoin network failed
|
|||
mainView.walletServiceErrorMsg.connectionError=Connection to the bitcoin network failed because of an error: {0}
|
||||
|
||||
mainView.networkWarning.allConnectionsLost=You lost the connection to all {0} network peers.\nMaybe you lost your internet connection or your computer was in standby mode.
|
||||
mainView.version.update=(Update available)
|
||||
|
||||
|
||||
####################################################################
|
||||
|
@ -1106,13 +1107,16 @@ contractWindow.contractHash=Contract hash:
|
|||
displayAlertMessageWindow.headline=Important information!
|
||||
displayAlertMessageWindow.update.headline=Important update information!
|
||||
displayAlertMessageWindow.update.download=Download:
|
||||
displayUpdateDownloadWindow.downloadedFiles=Downloaded files:
|
||||
displayUpdateDownloadWindow.downloadedFiles=Files:
|
||||
displayUpdateDownloadWindow.downloadingFile=Downloading: {0}
|
||||
displayUpdateDownloadWindow.verifiedSigs=Signature verified with keys:
|
||||
displayUpdateDownloadWindow.status.downloading=Downloading files...
|
||||
displayUpdateDownloadWindow.status.verifying=Verifying signature...
|
||||
displayUpdateDownloadWindow.button.label=Download installer and verify signature
|
||||
displayUpdateDownloadWindow.button.downloadLater=Download later
|
||||
displayUpdateDownloadWindow.button.ignoreDownload=Ignore that version
|
||||
displayUpdateDownloadWindow.headline=A new Bisq update is available!
|
||||
displayUpdateDownloadWindow.download.failed.headline=Download failed
|
||||
displayUpdateDownloadWindow.download.failed=Download failed.\n\
|
||||
Please download and verify manually at https://bisq.network/downloads
|
||||
displayUpdateDownloadWindow.installer.failed=Unable to determine the correct installer. Please download and verify manually at https://bisq.network/downloads
|
||||
|
|
|
@ -41,6 +41,12 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
@Slf4j
|
||||
public class Offer implements NetworkPayload, PersistablePayload {
|
||||
|
||||
// We allow max. 2 % difference between own offerPayload price calculation and takers calculation.
|
||||
// Market price might be different at maker's and takers side so we need a bit of tolerance.
|
||||
// The tolerance will get smaller once we have multiple price feeds avoiding fast price fluctuations
|
||||
// from one provider.
|
||||
final static double PRICE_TOLERANCE = 0.02;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Enums
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -173,11 +179,11 @@ public class Offer implements NetworkPayload, PersistablePayload {
|
|||
checkArgument(takersTradePrice > 0, "takersTradePrice must be positive");
|
||||
|
||||
double factor = (double) takersTradePrice / (double) offerPrice.getValue();
|
||||
// We allow max. 1 % difference between own offerPayload price calculation and takers calculation.
|
||||
// We allow max. 2 % difference between own offerPayload price calculation and takers calculation.
|
||||
// Market price might be different at maker's and takers side so we need a bit of tolerance.
|
||||
// The tolerance will get smaller once we have multiple price feeds avoiding fast price fluctuations
|
||||
// from one provider.
|
||||
if (Math.abs(1 - factor) > 0.01) {
|
||||
if (Math.abs(1 - factor) > PRICE_TOLERANCE) {
|
||||
String msg = "Taker's trade price is too far away from our calculated price based on the market price.\n" +
|
||||
"tradePrice=" + tradePrice.getValue() + "\n" +
|
||||
"offerPrice=" + offerPrice.getValue();
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory;
|
|||
public class OfferAvailabilityProtocol {
|
||||
private static final Logger log = LoggerFactory.getLogger(OfferAvailabilityProtocol.class);
|
||||
|
||||
private static final long TIMEOUT_SEC = 60;
|
||||
private static final long TIMEOUT_SEC = 90;
|
||||
|
||||
private final OfferAvailabilityModel model;
|
||||
private final ResultHandler resultHandler;
|
||||
|
|
|
@ -45,18 +45,20 @@ public class BroadcastMakerFeeTx extends Task<PlaceOfferModel> {
|
|||
try {
|
||||
runInterceptHook();
|
||||
final Transaction transaction = model.getTransaction();
|
||||
|
||||
// TODO Try to republish tx?
|
||||
Timer timeoutTimer = UserThread.runAfter(() -> {
|
||||
log.warn("Broadcast not completed after 5 sec. We go on with the trade protocol.");
|
||||
model.getOffer().setState(Offer.State.OFFER_FEE_PAID);
|
||||
complete();
|
||||
}, 5);
|
||||
}, 20);
|
||||
|
||||
model.getTradeWalletService().broadcastTx(model.getTransaction(),
|
||||
new FutureCallback<Transaction>() {
|
||||
@Override
|
||||
public void onSuccess(Transaction tx) {
|
||||
timeoutTimer.stop();
|
||||
if (!completed) {
|
||||
timeoutTimer.stop();
|
||||
log.debug("Broadcast of offer fee payment succeeded: transaction = " + tx.toString());
|
||||
|
||||
if (transaction.getHashAsString().equals(tx.getHashAsString())) {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class FeeService {
|
|||
|
||||
// DEFAULT_TX_FEE used in FeeRequestService for non-BTC currencies and for BTC only if we cannot access fee service
|
||||
// fees are per byte
|
||||
public static final long BTC_DEFAULT_TX_FEE = 100; // fees are between 50-400 sat/byte so we try to stay in average
|
||||
public static final long BTC_DEFAULT_TX_FEE = 100; // fees are between 20-400 sat/byte so we try to stay in average
|
||||
public static final long LTC_DEFAULT_TX_FEE = LTC_REFERENCE_DEFAULT_MIN_TX_FEE.value / 200;
|
||||
public static final long DOGE_DEFAULT_TX_FEE = DOGE_REFERENCE_DEFAULT_MIN_TX_FEE.value / 200; // 200 bytes tx -> 200*5_000_000L=1_000_000_000 (1 DOGE)
|
||||
public static final long DASH_DEFAULT_TX_FEE = DASH_REFERENCE_DEFAULT_MIN_TX_FEE.value / 200; // 200 bytes tx -> 200*50=10000
|
||||
|
@ -101,10 +101,10 @@ public class FeeService {
|
|||
*/
|
||||
switch (baseCurrencyCode) {
|
||||
case "BTC":
|
||||
MIN_MAKER_FEE_IN_BASE_CUR = 20_000; // 2 USD at BTC price 10000 USD
|
||||
MIN_MAKER_FEE_IN_BASE_CUR = 20_000; // 3 USD at BTC price 15000 USD
|
||||
MIN_TAKER_FEE_IN_BASE_CUR = 20_000;
|
||||
DEFAULT_MAKER_FEE_IN_BASE_CUR = 200_000; // 20 USD at BTC price 10000 USD for 1 BTC (maxTradeAmount)
|
||||
DEFAULT_TAKER_FEE_IN_BASE_CUR = 200_000; // 20 USD at BTC price 10000 USD
|
||||
DEFAULT_MAKER_FEE_IN_BASE_CUR = 200_000; // 7.5 USD at BTC price 15000 USD for 0.25 BTC (maxTradeAmount for most fiat trades)
|
||||
DEFAULT_TAKER_FEE_IN_BASE_CUR = 200_000;
|
||||
txFeePerByte = BTC_DEFAULT_TX_FEE;
|
||||
break;
|
||||
case "LTC":
|
||||
|
|
|
@ -54,8 +54,7 @@ import javafx.scene.input.KeyEvent;
|
|||
import javafx.scene.layout.*;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.TextAlignment;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
|
@ -63,8 +62,11 @@ import java.util.List;
|
|||
import static javafx.scene.layout.AnchorPane.*;
|
||||
|
||||
@FxmlView
|
||||
@Slf4j
|
||||
public class MainView extends InitializableView<StackPane, MainViewModel> {
|
||||
private static final Logger log = LoggerFactory.getLogger(MainView.class);
|
||||
// If after 30 sec we have not got connected we show "open network settings" button
|
||||
private final static int SHOW_TOR_SETTINGS_DELAY_SEC = 30;
|
||||
private Label versionLabel;
|
||||
|
||||
public static StackPane getRootContainer() {
|
||||
return MainView.rootContainer;
|
||||
|
@ -485,11 +487,10 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
splashP2PNetworkIcon.setManaged(false);
|
||||
HBox.setMargin(splashP2PNetworkIcon, new Insets(0, 0, 5, 0));
|
||||
|
||||
// If after 20 sec we have not got connected we show "open network settings" button
|
||||
Timer showTorNetworkSettingsTimer = UserThread.runAfter(() -> {
|
||||
showTorNetworkSettingsButton.setVisible(true);
|
||||
showTorNetworkSettingsButton.setManaged(true);
|
||||
}, 20);
|
||||
}, SHOW_TOR_SETTINGS_DELAY_SEC);
|
||||
|
||||
splashP2PNetworkIconIdListener = (ov, oldValue, newValue) -> {
|
||||
splashP2PNetworkIcon.setId(newValue);
|
||||
|
@ -579,7 +580,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
setBottomAnchor(blockchainSyncBox, 7d);
|
||||
|
||||
// version
|
||||
Label versionLabel = new Label();
|
||||
versionLabel = new Label();
|
||||
versionLabel.setId("footer-pane");
|
||||
versionLabel.setTextAlignment(TextAlignment.CENTER);
|
||||
versionLabel.setAlignment(Pos.BASELINE_CENTER);
|
||||
|
@ -588,7 +589,17 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
versionLabel.setLayoutX(((double) newValue - versionLabel.getWidth()) / 2);
|
||||
});
|
||||
setBottomAnchor(versionLabel, 7d);
|
||||
|
||||
model.newVersionAvailableProperty.addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue) {
|
||||
versionLabel.setStyle("-fx-text-fill: -bs-error-red; -fx-underline: true; -fx-cursor: hand;");
|
||||
versionLabel.setOnMouseClicked(e -> model.openDownloadWindow());
|
||||
versionLabel.setText("v" + Version.VERSION + " " + Res.get("mainView.version.update"));
|
||||
} else {
|
||||
versionLabel.setStyle("-fx-text-fill: black; -fx-underline: false; -fx-cursor: null;");
|
||||
versionLabel.setOnMouseClicked(null);
|
||||
versionLabel.setText("v" + Version.VERSION);
|
||||
}
|
||||
});
|
||||
|
||||
// P2P Network
|
||||
Label p2PNetworkLabel = new Label();
|
||||
|
|
|
@ -158,6 +158,7 @@ public class MainViewModel implements ViewModel {
|
|||
final BooleanProperty isCryptoCurrencyPriceFeedSelected = new SimpleBooleanProperty(false);
|
||||
final BooleanProperty isExternallyProvidedPrice = new SimpleBooleanProperty(true);
|
||||
final BooleanProperty isPriceAvailable = new SimpleBooleanProperty(false);
|
||||
final BooleanProperty newVersionAvailableProperty = new SimpleBooleanProperty(false);
|
||||
final IntegerProperty marketPriceUpdated = new SimpleIntegerProperty(0);
|
||||
final StringProperty availableBalance = new SimpleStringProperty();
|
||||
final StringProperty reservedBalance = new SimpleStringProperty();
|
||||
|
@ -633,9 +634,9 @@ public class MainViewModel implements ViewModel {
|
|||
removeOffersWithoutAccountAgeWitness();
|
||||
|
||||
arbitratorManager.onAllServicesInitialized();
|
||||
alertManager.alertMessageProperty().addListener((observable, oldValue, newValue) -> displayAlertIfPresent(newValue));
|
||||
alertManager.alertMessageProperty().addListener((observable, oldValue, newValue) -> displayAlertIfPresent(newValue, false));
|
||||
privateNotificationManager.privateNotificationProperty().addListener((observable, oldValue, newValue) -> displayPrivateNotification(newValue));
|
||||
displayAlertIfPresent(alertManager.alertMessageProperty().get());
|
||||
displayAlertIfPresent(alertManager.alertMessageProperty().get(), false);
|
||||
|
||||
p2PService.onAllServicesInitialized();
|
||||
|
||||
|
@ -1048,15 +1049,34 @@ public class MainViewModel implements ViewModel {
|
|||
priceFeedComboBoxItems.setAll(currencyItems);
|
||||
}
|
||||
|
||||
private void displayAlertIfPresent(Alert alert) {
|
||||
boolean alreadyDisplayed = alert != null && alert.equals(user.getDisplayedAlert());
|
||||
user.setDisplayedAlert(alert);
|
||||
if (alert != null && !alreadyDisplayed) {
|
||||
private void displayAlertIfPresent(Alert alert, boolean openNewVersionPopup) {
|
||||
if (alert != null) {
|
||||
if (alert.isUpdateInfo()) {
|
||||
if (alert.isNewVersion())
|
||||
new DisplayUpdateDownloadWindow(alert).show();
|
||||
user.setDisplayedAlert(alert);
|
||||
final boolean isNewVersion = alert.isNewVersion();
|
||||
newVersionAvailableProperty.set(isNewVersion);
|
||||
String key = "Update_" + alert.getVersion();
|
||||
if (isNewVersion && (preferences.showAgain(key) || openNewVersionPopup)) {
|
||||
new DisplayUpdateDownloadWindow(alert)
|
||||
.actionButtonText(Res.get("displayUpdateDownloadWindow.button.downloadLater"))
|
||||
.onAction(() -> {
|
||||
preferences.dontShowAgain(key, false); // update later
|
||||
})
|
||||
.closeButtonText(Res.get("shared.cancel"))
|
||||
.onClose(() -> {
|
||||
preferences.dontShowAgain(key, true); // ignore update
|
||||
})
|
||||
.show();
|
||||
}
|
||||
} else {
|
||||
new DisplayAlertMessageWindow().alertMessage(alert).show();
|
||||
final Alert displayedAlert = user.getDisplayedAlert();
|
||||
if (displayedAlert == null || !displayedAlert.equals(alert))
|
||||
new DisplayAlertMessageWindow()
|
||||
.alertMessage(alert)
|
||||
.onClose(() -> {
|
||||
user.setDisplayedAlert(alert);
|
||||
})
|
||||
.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1255,4 +1275,8 @@ public class MainViewModel implements ViewModel {
|
|||
String getAppDateDir() {
|
||||
return bisqEnvironment.getProperty(AppOptionKeys.APP_DATA_DIR_KEY);
|
||||
}
|
||||
|
||||
void openDownloadWindow() {
|
||||
displayAlertIfPresent(user.getDisplayedAlert(), true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package io.bisq.gui.main.dao;
|
|||
|
||||
import io.bisq.common.app.DevEnv;
|
||||
import io.bisq.common.locale.Res;
|
||||
import io.bisq.core.app.BisqEnvironment;
|
||||
import io.bisq.gui.Navigation;
|
||||
import io.bisq.gui.common.model.Activatable;
|
||||
import io.bisq.gui.common.view.*;
|
||||
|
@ -63,7 +64,7 @@ public class DaoView extends ActivatableViewAndModel<TabPane, Activatable> {
|
|||
votingTab.setClosable(false);
|
||||
root.getTabs().addAll(compensationTab, votingTab);
|
||||
|
||||
if (!DevEnv.DAO_PHASE2_ACTIVATED) {
|
||||
if (!BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq() || !DevEnv.DAO_PHASE2_ACTIVATED) {
|
||||
votingTab.setDisable(true);
|
||||
compensationTab.setDisable(true);
|
||||
}
|
||||
|
|
|
@ -721,7 +721,6 @@ class CreateOfferDataModel extends ActivatableDataModel {
|
|||
}
|
||||
|
||||
public void swapTradeToSavings() {
|
||||
log.error("swapTradeToSavings, offerId={}", offerId);
|
||||
btcWalletService.resetAddressEntriesForOpenOffer(offerId);
|
||||
}
|
||||
|
||||
|
|
|
@ -459,6 +459,10 @@ public abstract class Overlay<T extends Overlay> {
|
|||
Window window = rootScene.getWindow();
|
||||
setModality();
|
||||
stage.initStyle(StageStyle.TRANSPARENT);
|
||||
stage.setOnCloseRequest(event -> {
|
||||
event.consume();
|
||||
doClose();
|
||||
});
|
||||
stage.show();
|
||||
|
||||
layout();
|
||||
|
|
|
@ -123,15 +123,28 @@ public class SendAlertMessageWindow extends Overlay<SendAlertMessageWindow> {
|
|||
|
||||
Button sendButton = new Button(Res.get("sendAlertMessageWindow.send"));
|
||||
sendButton.setOnAction(e -> {
|
||||
if (alertMessageTextArea.getText().length() > 0 && keyInputTextField.getText().length() > 0) {
|
||||
if (sendAlertMessageHandler.handle(
|
||||
new Alert(alertMessageTextArea.getText(),
|
||||
isUpdateCheckBox.isSelected(),
|
||||
versionInputTextField.getText()),
|
||||
keyInputTextField.getText()))
|
||||
hide();
|
||||
else
|
||||
new Popup<>().warning(Res.get("shared.invalidKey")).width(300).onClose(this::blurAgain).show();
|
||||
final String version = versionInputTextField.getText();
|
||||
boolean versionOK = false;
|
||||
final boolean isUpdate = isUpdateCheckBox.isSelected();
|
||||
if (isUpdate) {
|
||||
final String[] split = version.split("\\.");
|
||||
versionOK = split.length == 3;
|
||||
if (!versionOK) // Do not translate as only used by devs
|
||||
new Popup<>().warning("Version number must be in semantic version format (contain 2 '.'). version=" + version)
|
||||
.onClose(this::blurAgain)
|
||||
.show();
|
||||
}
|
||||
if (!isUpdate || versionOK) {
|
||||
if (alertMessageTextArea.getText().length() > 0 && keyInputTextField.getText().length() > 0) {
|
||||
if (sendAlertMessageHandler.handle(
|
||||
new Alert(alertMessageTextArea.getText(),
|
||||
isUpdate,
|
||||
version),
|
||||
keyInputTextField.getText()))
|
||||
hide();
|
||||
else
|
||||
new Popup<>().warning(Res.get("shared.invalidKey")).width(300).onClose(this::blurAgain).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -30,10 +30,12 @@ import javafx.geometry.HPos;
|
|||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Orientation;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import javafx.scene.control.Separator;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -45,11 +47,12 @@ import java.util.List;
|
|||
import java.util.Optional;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static io.bisq.gui.util.FormBuilder.*;
|
||||
import static io.bisq.gui.util.FormBuilder.addLabel;
|
||||
import static io.bisq.gui.util.FormBuilder.addMultilineLabel;
|
||||
|
||||
@Slf4j
|
||||
public class DisplayUpdateDownloadWindow extends Overlay<DisplayUpdateDownloadWindow> {
|
||||
private Alert alert;
|
||||
private final Alert alert;
|
||||
private Optional<DownloadTask> downloadTaskOptional;
|
||||
private VerifyTask verifyTask;
|
||||
private ProgressBar progressBar;
|
||||
|
@ -73,6 +76,7 @@ public class DisplayUpdateDownloadWindow extends Overlay<DisplayUpdateDownloadWi
|
|||
addHeadLine();
|
||||
addSeparator();
|
||||
addContent();
|
||||
addCloseButton();
|
||||
applyStyles();
|
||||
display();
|
||||
}
|
||||
|
@ -162,25 +166,6 @@ public class DisplayUpdateDownloadWindow extends Overlay<DisplayUpdateDownloadWi
|
|||
GridPane.setMargin(separator2, new Insets(20, 0, 20, 0));
|
||||
gridPane.getChildren().add(separator2);
|
||||
|
||||
|
||||
closeButton = addButton(gridPane, ++rowIndex, Res.get("shared.close"));
|
||||
closeButton.setDefaultButton(false);
|
||||
GridPane.setColumnIndex(closeButton, 0);
|
||||
GridPane.setHalignment(closeButton, HPos.LEFT);
|
||||
GridPane.setColumnSpan(closeButton, 2);
|
||||
closeButton.setOnAction(e -> {
|
||||
if (verifyTask != null && verifyTask.isRunning())
|
||||
verifyTask.cancel();
|
||||
if (downloadTaskOptional != null && downloadTaskOptional.isPresent() && downloadTaskOptional.get().isRunning())
|
||||
downloadTaskOptional.get().cancel();
|
||||
|
||||
stopAnimations();
|
||||
|
||||
hide();
|
||||
closeHandlerOptional.ifPresent(Runnable::run);
|
||||
});
|
||||
|
||||
|
||||
BisqInstaller installer = new BisqInstaller();
|
||||
String downloadFailedString = Res.get("displayUpdateDownloadWindow.download.failed");
|
||||
downloadButton.setOnAction(e -> {
|
||||
|
@ -201,8 +186,6 @@ public class DisplayUpdateDownloadWindow extends Overlay<DisplayUpdateDownloadWi
|
|||
final ChangeListener<String> downloadedFilesListener = (observable, oldValue, newValue) -> {
|
||||
if (!newValue.endsWith("-local")) {
|
||||
downloadingFileLabel.setText(Res.get("displayUpdateDownloadWindow.downloadingFile", newValue));
|
||||
if (downloadedFiles.size() == 1)
|
||||
downloadedFilesLabel.setStyle("-fx-text-fill: -bs-green;");
|
||||
downloadedFilesLabel.setText(downloadedFilesLabelTitle + " " + Joiner.on(", ").join(downloadedFiles));
|
||||
downloadedFiles.add(newValue);
|
||||
}
|
||||
|
@ -217,7 +200,6 @@ public class DisplayUpdateDownloadWindow extends Overlay<DisplayUpdateDownloadWi
|
|||
progressBar.setVisible(false);
|
||||
downloadingFileLabel.setText("");
|
||||
downloadingFileLabel.setOpacity(0.2);
|
||||
//-bs-green
|
||||
statusLabel.setText(Res.get("displayUpdateDownloadWindow.status.verifying"));
|
||||
|
||||
List<BisqInstaller.FileDescriptor> downloadResults = downloadTask.getValue();
|
||||
|
@ -225,8 +207,10 @@ public class DisplayUpdateDownloadWindow extends Overlay<DisplayUpdateDownloadWi
|
|||
.filter(fileDescriptor -> !BisqInstaller.DownloadStatusEnum.OK.equals(fileDescriptor.getDownloadStatus())).findFirst();
|
||||
if (downloadResults == null || downloadResults.isEmpty() || downloadFailed.isPresent()) {
|
||||
showErrorMessage(downloadButton, statusLabel, downloadFailedString);
|
||||
downloadedFilesLabel.setStyle("-fx-text-fill: -bs-error-red;");
|
||||
} else {
|
||||
log.debug("Download completed successfully.");
|
||||
downloadedFilesLabel.setStyle("-fx-text-fill: -bs-green;");
|
||||
|
||||
verifyTask = installer.verify(downloadResults);
|
||||
verifiedSigLabel.setOpacity(1);
|
||||
|
@ -255,11 +239,13 @@ public class DisplayUpdateDownloadWindow extends Overlay<DisplayUpdateDownloadWi
|
|||
.onAction(() -> {
|
||||
try {
|
||||
Utilities.openFile(new File(Utilities.getDownloadOfHomeDir()));
|
||||
doClose();
|
||||
} catch (IOException e2) {
|
||||
log.error(e2.getMessage());
|
||||
e2.printStackTrace();
|
||||
}
|
||||
})
|
||||
.onClose(this::doClose)
|
||||
.show();
|
||||
log.info("Download & verification succeeded.");
|
||||
}
|
||||
|
@ -275,11 +261,73 @@ public class DisplayUpdateDownloadWindow extends Overlay<DisplayUpdateDownloadWi
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addCloseButton() {
|
||||
closeButton = new Button(Res.get("displayUpdateDownloadWindow.button.ignoreDownload"));
|
||||
closeButton.setOnAction(event -> doClose());
|
||||
actionButton = new Button(Res.get("displayUpdateDownloadWindow.button.downloadLater"));
|
||||
actionButton.setDefaultButton(false);
|
||||
actionButton.setOnAction(event -> {
|
||||
cleanup();
|
||||
hide();
|
||||
actionHandlerOptional.ifPresent(Runnable::run);
|
||||
});
|
||||
|
||||
HBox hBox = new HBox();
|
||||
hBox.setSpacing(10);
|
||||
hBox.getChildren().addAll(closeButton, actionButton);
|
||||
|
||||
GridPane.setHalignment(hBox, HPos.LEFT);
|
||||
GridPane.setRowIndex(hBox, ++rowIndex);
|
||||
GridPane.setColumnSpan(hBox, 2);
|
||||
GridPane.setMargin(hBox, new Insets(buttonDistance, 0, 0, 0));
|
||||
gridPane.getChildren().add(hBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupKeyHandler(Scene scene) {
|
||||
if (!hideCloseButton) {
|
||||
scene.setOnKeyPressed(e -> {
|
||||
if (e.getCode() == KeyCode.ESCAPE || e.getCode() == KeyCode.ENTER) {
|
||||
e.consume();
|
||||
cleanup();
|
||||
hide();
|
||||
actionHandlerOptional.ifPresent(Runnable::run);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doClose() {
|
||||
super.doClose();
|
||||
|
||||
cleanup();
|
||||
stopAnimations();
|
||||
|
||||
hide();
|
||||
closeHandlerOptional.ifPresent(Runnable::run);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cleanup() {
|
||||
super.cleanup();
|
||||
|
||||
if (verifyTask != null && verifyTask.isRunning())
|
||||
verifyTask.cancel();
|
||||
if (downloadTaskOptional != null && downloadTaskOptional.isPresent() && downloadTaskOptional.get().isRunning())
|
||||
downloadTaskOptional.get().cancel();
|
||||
}
|
||||
|
||||
private void showErrorMessage(Button downloadButton, Label statusLabel, String errorMsg) {
|
||||
statusLabel.setText("");
|
||||
stopAnimations();
|
||||
downloadButton.setDisable(false);
|
||||
new Popup<>().warning(errorMsg).show();
|
||||
new Popup<>()
|
||||
.headLine(Res.get("displayUpdateDownloadWindow.download.failed.headline"))
|
||||
.feedback(errorMsg)
|
||||
.onClose(this::doClose)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void stopAnimations() {
|
||||
|
|
|
@ -88,9 +88,7 @@ public class DownloadTask extends Task<List<FileDescriptor>> {
|
|||
return fileDescriptors.stream()
|
||||
.map(fileDescriptor -> {
|
||||
fileDescriptor.setSaveFile(new File(partialSaveFilePath + fileDescriptor.getFileName()));
|
||||
return fileDescriptor;
|
||||
})
|
||||
.map(fileDescriptor -> {
|
||||
|
||||
log.info("Downloading {}", fileDescriptor.getLoadUrl());
|
||||
try {
|
||||
updateMessage(fileDescriptor.getFileName());
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<dependency>
|
||||
<groupId>com.github.JesusMcCloud.netlayer</groupId>
|
||||
<artifactId>tor.native</artifactId>
|
||||
<version>e7195748</version>
|
||||
<version>1c9d80e</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
|
|
|
@ -636,7 +636,7 @@ public class Connection implements MessageListener {
|
|||
closeConnectionReason = CloseConnectionReason.RESET;
|
||||
} else if (e instanceof SocketTimeoutException || e instanceof TimeoutException) {
|
||||
closeConnectionReason = CloseConnectionReason.SOCKET_TIMEOUT;
|
||||
log.warn("Shut down caused by exception {} on connection={}", e.toString(), connection);
|
||||
log.info("Shut down caused by exception {} on connection={}", e.toString(), connection);
|
||||
} else if (e instanceof EOFException) {
|
||||
closeConnectionReason = CloseConnectionReason.TERMINATED;
|
||||
log.warn("Shut down caused by exception {} on connection={}", e.toString(), connection);
|
||||
|
|
|
@ -18,6 +18,5 @@
|
|||
package io.bisq.provider;
|
||||
|
||||
public class ProviderVersion {
|
||||
// Bisq v0.6.1 did not change anything relevant for that project so we stick with 0.6.0
|
||||
public static final String VERSION = "0.6.0";
|
||||
public static final String VERSION = "0.6.1";
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ import java.util.LinkedList;
|
|||
//TODO consider alternative https://www.bitgo.com/api/v1/tx/fee?numBlocks=3
|
||||
@Slf4j
|
||||
public class BtcFeesProvider {
|
||||
static int CAPACITY = 12; // we request each 5 min. so we take average of last hour
|
||||
static int MAX_BLOCKS = 20;
|
||||
static int CAPACITY = 6; // we request each 5 min. so we take average of last 30 min.
|
||||
static int MAX_BLOCKS = 15;
|
||||
|
||||
private final HttpClient httpClient;
|
||||
LinkedList<Long> fees = new LinkedList<>();
|
||||
|
|
|
@ -39,12 +39,12 @@ public class PriceRequestService {
|
|||
private static final Logger log = LoggerFactory.getLogger(PriceRequestService.class);
|
||||
|
||||
// We adjust request time to fit into BitcoinAverage developer plan (45k request per month).
|
||||
// We get 42514 request be below numbers.
|
||||
private static final long INTERVAL_BTC_AV_LOCAL_MS = 90_000; // 90 sec
|
||||
private static final long INTERVAL_BTC_AV_GLOBAL_MS = 210_000; // 3.5 min
|
||||
// We get 42514 (29760+12754) request with below numbers.
|
||||
private static final long INTERVAL_BTC_AV_LOCAL_MS = 90_000; // 90 sec; 29760 requests for 31 days
|
||||
private static final long INTERVAL_BTC_AV_GLOBAL_MS = 210_000; // 3.5 min; 12754 requests for 31 days
|
||||
|
||||
private static final long INTERVAL_POLONIEX_MS = 60_000; // 1 min
|
||||
private static final long INTERVAL_COIN_MARKET_CAP_MS = 300_000; // 5 min
|
||||
private static final long INTERVAL_COIN_MARKET_CAP_MS = 300_000; // 5 min that data structure is quite heavy so we don't request too often.
|
||||
private static final long MARKET_PRICE_TTL_SEC = 1800; // 30 min
|
||||
|
||||
private final Timer timerBtcAverageLocal = new Timer();
|
||||
|
|
|
@ -138,23 +138,21 @@ public class SeedNodeMain extends BisqExecutable {
|
|||
|
||||
UserThread.runPeriodically(() -> {
|
||||
Profiler.printSystemLoad(log);
|
||||
long usedMemoryInMB = Profiler.getUsedMemoryInMB();
|
||||
if (!stopped) {
|
||||
if (usedMemoryInMB > (maxMemory - 100)) {
|
||||
long usedMemoryInMB = Profiler.getUsedMemoryInMB();
|
||||
if (usedMemoryInMB > (maxMemory * 0.8)) {
|
||||
log.warn("\n\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n" +
|
||||
"We are over our memory warn limit and call the GC. usedMemoryInMB: {}" +
|
||||
"\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n\n",
|
||||
usedMemoryInMB);
|
||||
System.gc();
|
||||
usedMemoryInMB = Profiler.getUsedMemoryInMB();
|
||||
Profiler.printSystemLoad(log);
|
||||
}
|
||||
|
||||
final long finalUsedMemoryInMB = usedMemoryInMB;
|
||||
UserThread.runAfter(() -> {
|
||||
if (finalUsedMemoryInMB > maxMemory)
|
||||
if (Profiler.getUsedMemoryInMB() > maxMemory)
|
||||
restart(bisqEnvironment);
|
||||
}, 1);
|
||||
}, 5);
|
||||
}
|
||||
}, CHECK_MEMORY_PERIOD_SEC);
|
||||
|
||||
|
|
|
@ -133,20 +133,19 @@ public class StatisticsMain extends BisqExecutable {
|
|||
|
||||
UserThread.runPeriodically(() -> {
|
||||
Profiler.printSystemLoad(log);
|
||||
long usedMemoryInMB = Profiler.getUsedMemoryInMB();
|
||||
if (!stopped) {
|
||||
if (usedMemoryInMB > (maxMemory - 100)) {
|
||||
long usedMemoryInMB = Profiler.getUsedMemoryInMB();
|
||||
if (usedMemoryInMB > (maxMemory * 0.8)) {
|
||||
log.warn("\n\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n" +
|
||||
"We are over our memory warn limit and call the GC. usedMemoryInMB: {}" +
|
||||
"\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n\n",
|
||||
usedMemoryInMB);
|
||||
System.gc();
|
||||
usedMemoryInMB = Profiler.getUsedMemoryInMB();
|
||||
Profiler.printSystemLoad(log);
|
||||
}
|
||||
|
||||
final long finalUsedMemoryInMB = usedMemoryInMB;
|
||||
UserThread.runAfter(() -> {
|
||||
final long finalUsedMemoryInMB = Profiler.getUsedMemoryInMB();
|
||||
if (finalUsedMemoryInMB > maxMemory) {
|
||||
log.error("\n\n############################################################\n" +
|
||||
"We shut down as we are over our memory limit. usedMemoryInMB: {}" +
|
||||
|
@ -154,7 +153,7 @@ public class StatisticsMain extends BisqExecutable {
|
|||
finalUsedMemoryInMB);
|
||||
System.exit(EXIT_FAILURE);
|
||||
}
|
||||
}, 1);
|
||||
}, 5);
|
||||
}
|
||||
}, CHECK_MEMORY_PERIOD_SEC);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue