mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-31 18:58:51 -04:00
Merge branch 'haveno-dex:master' into haveno-reto
This commit is contained in:
commit
4666430429
3 changed files with 200 additions and 217 deletions
|
@ -1343,6 +1343,7 @@ public class XmrWalletService extends XmrWalletBase {
|
||||||
try {
|
try {
|
||||||
doMaybeInitMainWallet(sync, MAX_SYNC_ATTEMPTS);
|
doMaybeInitMainWallet(sync, MAX_SYNC_ATTEMPTS);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (isShutDownStarted) return;
|
||||||
log.warn("Error initializing main wallet: {}\n", e.getMessage(), e);
|
log.warn("Error initializing main wallet: {}\n", e.getMessage(), e);
|
||||||
HavenoUtils.setTopError(e.getMessage());
|
HavenoUtils.setTopError(e.getMessage());
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -1510,10 +1511,11 @@ public class XmrWalletService extends XmrWalletBase {
|
||||||
// try opening wallet
|
// try opening wallet
|
||||||
config.setNetworkType(getMoneroNetworkType());
|
config.setNetworkType(getMoneroNetworkType());
|
||||||
config.setServer(connection);
|
config.setServer(connection);
|
||||||
log.info("Opening full wallet " + config.getPath() + " with monerod=" + connection.getUri() + ", proxyUri=" + connection.getProxyUri());
|
log.info("Opening full wallet '{}' with monerod={}, proxyUri={}", config.getPath(), connection.getUri(), connection.getProxyUri());
|
||||||
try {
|
try {
|
||||||
walletFull = MoneroWalletFull.openWallet(config);
|
walletFull = MoneroWalletFull.openWallet(config);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (isShutDownStarted) throw e;
|
||||||
log.warn("Failed to open full wallet '{}', attempting to use backup cache files, error={}", config.getPath(), e.getMessage());
|
log.warn("Failed to open full wallet '{}', attempting to use backup cache files, error={}", config.getPath(), e.getMessage());
|
||||||
boolean retrySuccessful = false;
|
boolean retrySuccessful = false;
|
||||||
try {
|
try {
|
||||||
|
@ -1551,7 +1553,7 @@ public class XmrWalletService extends XmrWalletBase {
|
||||||
|
|
||||||
// retry opening wallet after cache deleted
|
// retry opening wallet after cache deleted
|
||||||
try {
|
try {
|
||||||
log.warn("Failed to open full wallet using backup cache files, retrying with cache deleted");
|
log.warn("Failed to open full wallet '{}' using backup cache files, retrying with cache deleted", config.getPath());
|
||||||
walletFull = MoneroWalletFull.openWallet(config);
|
walletFull = MoneroWalletFull.openWallet(config);
|
||||||
log.warn("Successfully opened full wallet after cache deleted");
|
log.warn("Successfully opened full wallet after cache deleted");
|
||||||
retrySuccessful = true;
|
retrySuccessful = true;
|
||||||
|
@ -1565,7 +1567,7 @@ public class XmrWalletService extends XmrWalletBase {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// restore original wallet cache
|
// restore original wallet cache
|
||||||
log.warn("Failed to open full wallet after deleting cache, restoring original cache");
|
log.warn("Failed to open full wallet '{}' after deleting cache, restoring original cache", config.getPath());
|
||||||
File cacheFile = new File(cachePath);
|
File cacheFile = new File(cachePath);
|
||||||
if (cacheFile.exists()) cacheFile.delete();
|
if (cacheFile.exists()) cacheFile.delete();
|
||||||
if (originalCacheBackup.exists()) originalCacheBackup.renameTo(new File(cachePath));
|
if (originalCacheBackup.exists()) originalCacheBackup.renameTo(new File(cachePath));
|
||||||
|
@ -1637,11 +1639,12 @@ public class XmrWalletService extends XmrWalletBase {
|
||||||
if (!applyProxyUri) connection.setProxyUri(null);
|
if (!applyProxyUri) connection.setProxyUri(null);
|
||||||
|
|
||||||
// try opening wallet
|
// try opening wallet
|
||||||
log.info("Opening RPC wallet " + config.getPath() + " with monerod=" + connection.getUri() + ", proxyUri=" + connection.getProxyUri());
|
log.info("Opening RPC wallet '{}' with monerod={}, proxyUri={}", config.getPath(), connection.getUri(), connection.getProxyUri());
|
||||||
config.setServer(connection);
|
config.setServer(connection);
|
||||||
try {
|
try {
|
||||||
walletRpc.openWallet(config);
|
walletRpc.openWallet(config);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (isShutDownStarted) throw e;
|
||||||
log.warn("Failed to open RPC wallet '{}', attempting to use backup cache files, error={}", config.getPath(), e.getMessage());
|
log.warn("Failed to open RPC wallet '{}', attempting to use backup cache files, error={}", config.getPath(), e.getMessage());
|
||||||
boolean retrySuccessful = false;
|
boolean retrySuccessful = false;
|
||||||
try {
|
try {
|
||||||
|
@ -1679,7 +1682,7 @@ public class XmrWalletService extends XmrWalletBase {
|
||||||
|
|
||||||
// retry opening wallet after cache deleted
|
// retry opening wallet after cache deleted
|
||||||
try {
|
try {
|
||||||
log.warn("Failed to open RPC wallet using backup cache files, retrying with cache deleted");
|
log.warn("Failed to open RPC wallet '{}' using backup cache files, retrying with cache deleted", config.getPath());
|
||||||
walletRpc.openWallet(config);
|
walletRpc.openWallet(config);
|
||||||
log.warn("Successfully opened RPC wallet after cache deleted");
|
log.warn("Successfully opened RPC wallet after cache deleted");
|
||||||
retrySuccessful = true;
|
retrySuccessful = true;
|
||||||
|
@ -1693,7 +1696,7 @@ public class XmrWalletService extends XmrWalletBase {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// restore original wallet cache
|
// restore original wallet cache
|
||||||
log.warn("Failed to open RPC wallet after deleting cache, restoring original cache");
|
log.warn("Failed to open RPC wallet '{}' after deleting cache, restoring original cache", config.getPath());
|
||||||
File cacheFile = new File(cachePath);
|
File cacheFile = new File(cachePath);
|
||||||
if (cacheFile.exists()) cacheFile.delete();
|
if (cacheFile.exists()) cacheFile.delete();
|
||||||
if (originalCacheBackup.exists()) originalCacheBackup.renameTo(new File(cachePath));
|
if (originalCacheBackup.exists()) originalCacheBackup.renameTo(new File(cachePath));
|
||||||
|
|
|
@ -424,7 +424,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
currencySelectionSubscriber = currencySelectionBinding.subscribe((observable, oldValue, newValue) -> {
|
currencySelectionSubscriber = currencySelectionBinding.subscribe((observable, oldValue, newValue) -> {
|
||||||
});
|
});
|
||||||
|
|
||||||
tableView.setItems(model.getOfferList());
|
UserThread.execute(() -> tableView.setItems(model.getOfferList()));
|
||||||
|
|
||||||
model.getOfferList().addListener(offerListListener);
|
model.getOfferList().addListener(offerListListener);
|
||||||
nrOfOffersLabel.setText(Res.get("offerbook.nrOffers", model.getOfferList().size()));
|
nrOfOffersLabel.setText(Res.get("offerbook.nrOffers", model.getOfferList().size()));
|
||||||
|
@ -788,13 +788,11 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
return new TableCell<>() {
|
return new TableCell<>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final OfferBookListItem item, boolean empty) {
|
public void updateItem(final OfferBookListItem item, boolean empty) {
|
||||||
UserThread.execute(() -> {
|
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null && !empty)
|
if (item != null && !empty)
|
||||||
setGraphic(new ColoredDecimalPlacesWithZerosText(model.getAmount(item), GUIUtil.AMOUNT_DECIMALS_WITH_ZEROS));
|
setGraphic(new ColoredDecimalPlacesWithZerosText(model.getAmount(item), GUIUtil.AMOUNT_DECIMALS_WITH_ZEROS));
|
||||||
else
|
else
|
||||||
setGraphic(null);
|
setGraphic(null);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -819,13 +817,11 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final OfferBookListItem item, boolean empty) {
|
public void updateItem(final OfferBookListItem item, boolean empty) {
|
||||||
UserThread.execute(() -> {
|
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null && !empty)
|
if (item != null && !empty)
|
||||||
setText(CurrencyUtil.getCurrencyPair(item.getOffer().getCurrencyCode()));
|
setText(CurrencyUtil.getCurrencyPair(item.getOffer().getCurrencyCode()));
|
||||||
else
|
else
|
||||||
setText("");
|
setText("");
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -855,7 +851,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
return new TableCell<>() {
|
return new TableCell<>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final OfferBookListItem item, boolean empty) {
|
public void updateItem(final OfferBookListItem item, boolean empty) {
|
||||||
UserThread.execute(() -> {
|
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
|
|
||||||
if (item != null && !empty) {
|
if (item != null && !empty) {
|
||||||
|
@ -863,7 +858,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
} else {
|
} else {
|
||||||
setGraphic(null);
|
setGraphic(null);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private HBox getPriceAndPercentage(OfferBookListItem item) {
|
private HBox getPriceAndPercentage(OfferBookListItem item) {
|
||||||
|
@ -939,7 +933,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
return new TableCell<>() {
|
return new TableCell<>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final OfferBookListItem item, boolean empty) {
|
public void updateItem(final OfferBookListItem item, boolean empty) {
|
||||||
UserThread.execute(() -> {
|
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
|
|
||||||
if (item != null && !empty) {
|
if (item != null && !empty) {
|
||||||
|
@ -955,7 +948,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
setText("");
|
setText("");
|
||||||
setGraphic(null);
|
setGraphic(null);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -981,7 +973,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final OfferBookListItem item, boolean empty) {
|
public void updateItem(final OfferBookListItem item, boolean empty) {
|
||||||
UserThread.execute(() -> {
|
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
|
|
||||||
if (item != null && !empty) {
|
if (item != null && !empty) {
|
||||||
|
@ -1006,7 +997,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
if (field != null)
|
if (field != null)
|
||||||
field.setOnAction(null);
|
field.setOnAction(null);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1035,7 +1025,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
return new TableCell<>() {
|
return new TableCell<>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final OfferBookListItem item, boolean empty) {
|
public void updateItem(final OfferBookListItem item, boolean empty) {
|
||||||
UserThread.execute(() -> {
|
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
|
|
||||||
if (item != null && !empty) {
|
if (item != null && !empty) {
|
||||||
|
@ -1056,7 +1045,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
setText("");
|
setText("");
|
||||||
setGraphic(null);
|
setGraphic(null);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1083,7 +1071,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final OfferBookListItem item, boolean empty) {
|
public void updateItem(final OfferBookListItem item, boolean empty) {
|
||||||
UserThread.execute(() -> {
|
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
|
|
||||||
final ImageView iconView = new ImageView();
|
final ImageView iconView = new ImageView();
|
||||||
|
@ -1190,7 +1177,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
tableRow.setOnMousePressed(null);
|
tableRow.setOnMousePressed(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1218,7 +1204,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
return new TableCell<>() {
|
return new TableCell<>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final OfferBookListItem item, boolean empty) {
|
public void updateItem(final OfferBookListItem item, boolean empty) {
|
||||||
UserThread.execute(() -> {
|
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
|
|
||||||
if (item != null && !empty) {
|
if (item != null && !empty) {
|
||||||
|
@ -1230,7 +1215,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
} else {
|
} else {
|
||||||
setGraphic(null);
|
setGraphic(null);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1256,7 +1240,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
return new TableCell<>() {
|
return new TableCell<>() {
|
||||||
@Override
|
@Override
|
||||||
public void updateItem(final OfferBookListItem newItem, boolean empty) {
|
public void updateItem(final OfferBookListItem newItem, boolean empty) {
|
||||||
UserThread.execute(() -> {
|
|
||||||
super.updateItem(newItem, empty);
|
super.updateItem(newItem, empty);
|
||||||
if (newItem != null && !empty) {
|
if (newItem != null && !empty) {
|
||||||
final Offer offer = newItem.getOffer();
|
final Offer offer = newItem.getOffer();
|
||||||
|
@ -1275,7 +1258,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
||||||
} else {
|
} else {
|
||||||
setGraphic(null);
|
setGraphic(null);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,9 +277,6 @@ public class BroadcastHandler implements PeerManager.Listener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NotNull Throwable throwable) {
|
public void onFailure(@NotNull Throwable throwable) {
|
||||||
log.warn("Broadcast to " + connection.getPeersNodeAddressOptional() + " failed. ", throwable);
|
|
||||||
numOfFailedBroadcasts.incrementAndGet();
|
|
||||||
|
|
||||||
if (stopped.get()) {
|
if (stopped.get()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -356,7 +353,8 @@ public class BroadcastHandler implements PeerManager.Listener {
|
||||||
try {
|
try {
|
||||||
future.cancel(true);
|
future.cancel(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (!networkNode.isShutDownStarted()) throw e;
|
if (networkNode.isShutDownStarted()) return; // ignore if shut down
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
sendMessageFutures.clear();
|
sendMessageFutures.clear();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue