mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Merge pull request #5573 from ripcurlx/add-hint-to-upgrade-to-tor-v3
Add hint to upgrade to tor v3
This commit is contained in:
commit
8bc60d0909
21 changed files with 227 additions and 29 deletions
|
@ -102,6 +102,7 @@ public class BisqHeadlessApp implements HeadlessApp {
|
||||||
gracefulShutDownHandler.gracefulShutDown(() -> {
|
gracefulShutDownHandler.gracefulShutDown(() -> {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
bisqSetup.setTorAddressUpgradeHandler(() -> log.info("setTorAddressUpgradeHandler"));
|
||||||
|
|
||||||
corruptedStorageFileHandler.getFiles().ifPresent(files -> log.warn("getCorruptedDatabaseFiles. files={}", files));
|
corruptedStorageFileHandler.getFiles().ifPresent(files -> log.warn("getCorruptedDatabaseFiles. files={}", files));
|
||||||
tradeManager.setTakeOfferRequestErrorMessageHandler(errorMessage -> log.error("onTakeOfferRequestErrorMessageHandler"));
|
tradeManager.setTakeOfferRequestErrorMessageHandler(errorMessage -> log.error("onTakeOfferRequestErrorMessageHandler"));
|
||||||
|
|
|
@ -37,6 +37,10 @@ import bisq.core.payment.AmazonGiftCardAccount;
|
||||||
import bisq.core.payment.PaymentAccount;
|
import bisq.core.payment.PaymentAccount;
|
||||||
import bisq.core.payment.RevolutAccount;
|
import bisq.core.payment.RevolutAccount;
|
||||||
import bisq.core.payment.payload.PaymentMethod;
|
import bisq.core.payment.payload.PaymentMethod;
|
||||||
|
import bisq.core.support.dispute.Dispute;
|
||||||
|
import bisq.core.support.dispute.arbitration.ArbitrationManager;
|
||||||
|
import bisq.core.support.dispute.mediation.MediationManager;
|
||||||
|
import bisq.core.support.dispute.refund.RefundManager;
|
||||||
import bisq.core.trade.TradeManager;
|
import bisq.core.trade.TradeManager;
|
||||||
import bisq.core.trade.TradeTxException;
|
import bisq.core.trade.TradeTxException;
|
||||||
import bisq.core.user.Preferences;
|
import bisq.core.user.Preferences;
|
||||||
|
@ -47,6 +51,7 @@ import bisq.core.util.coin.CoinFormatter;
|
||||||
import bisq.network.Socks5ProxyProvider;
|
import bisq.network.Socks5ProxyProvider;
|
||||||
import bisq.network.p2p.P2PService;
|
import bisq.network.p2p.P2PService;
|
||||||
import bisq.network.p2p.storage.payload.PersistableNetworkPayload;
|
import bisq.network.p2p.storage.payload.PersistableNetworkPayload;
|
||||||
|
import bisq.network.utils.Utils;
|
||||||
|
|
||||||
import bisq.common.Timer;
|
import bisq.common.Timer;
|
||||||
import bisq.common.UserThread;
|
import bisq.common.UserThread;
|
||||||
|
@ -84,6 +89,7 @@ import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -135,10 +141,12 @@ public class BisqSetup {
|
||||||
private final UnconfirmedBsqChangeOutputListService unconfirmedBsqChangeOutputListService;
|
private final UnconfirmedBsqChangeOutputListService unconfirmedBsqChangeOutputListService;
|
||||||
private final Config config;
|
private final Config config;
|
||||||
private final AccountAgeWitnessService accountAgeWitnessService;
|
private final AccountAgeWitnessService accountAgeWitnessService;
|
||||||
private final TorSetup torSetup;
|
|
||||||
private final CoinFormatter formatter;
|
private final CoinFormatter formatter;
|
||||||
private final LocalBitcoinNode localBitcoinNode;
|
private final LocalBitcoinNode localBitcoinNode;
|
||||||
private final AppStartupState appStartupState;
|
private final AppStartupState appStartupState;
|
||||||
|
private final MediationManager mediationManager;
|
||||||
|
private final RefundManager refundManager;
|
||||||
|
private final ArbitrationManager arbitrationManager;
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -189,6 +197,9 @@ public class BisqSetup {
|
||||||
private Runnable daoRequiresRestartHandler;
|
private Runnable daoRequiresRestartHandler;
|
||||||
@Setter
|
@Setter
|
||||||
@Nullable
|
@Nullable
|
||||||
|
private Runnable torAddressUpgradeHandler;
|
||||||
|
@Setter
|
||||||
|
@Nullable
|
||||||
private Consumer<String> downGradePreventionHandler;
|
private Consumer<String> downGradePreventionHandler;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -217,11 +228,13 @@ public class BisqSetup {
|
||||||
UnconfirmedBsqChangeOutputListService unconfirmedBsqChangeOutputListService,
|
UnconfirmedBsqChangeOutputListService unconfirmedBsqChangeOutputListService,
|
||||||
Config config,
|
Config config,
|
||||||
AccountAgeWitnessService accountAgeWitnessService,
|
AccountAgeWitnessService accountAgeWitnessService,
|
||||||
TorSetup torSetup,
|
|
||||||
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
||||||
LocalBitcoinNode localBitcoinNode,
|
LocalBitcoinNode localBitcoinNode,
|
||||||
AppStartupState appStartupState,
|
AppStartupState appStartupState,
|
||||||
Socks5ProxyProvider socks5ProxyProvider) {
|
Socks5ProxyProvider socks5ProxyProvider,
|
||||||
|
MediationManager mediationManager,
|
||||||
|
RefundManager refundManager,
|
||||||
|
ArbitrationManager arbitrationManager) {
|
||||||
this.domainInitialisation = domainInitialisation;
|
this.domainInitialisation = domainInitialisation;
|
||||||
this.p2PNetworkSetup = p2PNetworkSetup;
|
this.p2PNetworkSetup = p2PNetworkSetup;
|
||||||
this.walletAppSetup = walletAppSetup;
|
this.walletAppSetup = walletAppSetup;
|
||||||
|
@ -238,10 +251,12 @@ public class BisqSetup {
|
||||||
this.unconfirmedBsqChangeOutputListService = unconfirmedBsqChangeOutputListService;
|
this.unconfirmedBsqChangeOutputListService = unconfirmedBsqChangeOutputListService;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.accountAgeWitnessService = accountAgeWitnessService;
|
this.accountAgeWitnessService = accountAgeWitnessService;
|
||||||
this.torSetup = torSetup;
|
|
||||||
this.formatter = formatter;
|
this.formatter = formatter;
|
||||||
this.localBitcoinNode = localBitcoinNode;
|
this.localBitcoinNode = localBitcoinNode;
|
||||||
this.appStartupState = appStartupState;
|
this.appStartupState = appStartupState;
|
||||||
|
this.mediationManager = mediationManager;
|
||||||
|
this.refundManager = refundManager;
|
||||||
|
this.arbitrationManager = arbitrationManager;
|
||||||
|
|
||||||
MemPoolSpaceTxBroadcaster.init(socks5ProxyProvider, preferences, localBitcoinNode);
|
MemPoolSpaceTxBroadcaster.init(socks5ProxyProvider, preferences, localBitcoinNode);
|
||||||
}
|
}
|
||||||
|
@ -312,6 +327,7 @@ public class BisqSetup {
|
||||||
maybeShowSecurityRecommendation();
|
maybeShowSecurityRecommendation();
|
||||||
maybeShowLocalhostRunningInfo();
|
maybeShowLocalhostRunningInfo();
|
||||||
maybeShowAccountSigningStateInfo();
|
maybeShowAccountSigningStateInfo();
|
||||||
|
maybeShowTorAddressUpgradeInformation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -563,8 +579,6 @@ public class BisqSetup {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static File getVersionFile() {
|
private static File getVersionFile() {
|
||||||
return new File(Config.appDataDir(), VERSION_FILE_NAME);
|
return new File(Config.appDataDir(), VERSION_FILE_NAME);
|
||||||
}
|
}
|
||||||
|
@ -702,6 +716,31 @@ public class BisqSetup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void maybeShowTorAddressUpgradeInformation() {
|
||||||
|
if (Config.baseCurrencyNetwork().isRegtest() ||
|
||||||
|
Utils.isV3Address(Objects.requireNonNull(p2PService.getNetworkNode().getNodeAddress()).getHostName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
maybeRunTorNodeAddressUpgradeHandler();
|
||||||
|
|
||||||
|
tradeManager.getNumPendingTrades().addListener((observable, oldValue, newValue) -> {
|
||||||
|
long numPendingTrades = (long) newValue;
|
||||||
|
if (numPendingTrades == 0) {
|
||||||
|
maybeRunTorNodeAddressUpgradeHandler();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void maybeRunTorNodeAddressUpgradeHandler() {
|
||||||
|
if (mediationManager.getDisputesAsObservableList().stream().allMatch(Dispute::isClosed) &&
|
||||||
|
refundManager.getDisputesAsObservableList().stream().allMatch(Dispute::isClosed) &&
|
||||||
|
arbitrationManager.getDisputesAsObservableList().stream().allMatch(Dispute::isClosed) &&
|
||||||
|
tradeManager.getNumPendingTrades().isEqualTo(0).get()) {
|
||||||
|
Objects.requireNonNull(torAddressUpgradeHandler).run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Getters
|
// Getters
|
||||||
|
|
|
@ -19,6 +19,7 @@ package bisq.core.offer;
|
||||||
|
|
||||||
import bisq.common.app.Capabilities;
|
import bisq.common.app.Capabilities;
|
||||||
import bisq.common.app.Capability;
|
import bisq.common.app.Capability;
|
||||||
|
import bisq.common.config.Config;
|
||||||
import bisq.common.util.Utilities;
|
import bisq.common.util.Utilities;
|
||||||
|
|
||||||
import org.bitcoinj.core.Coin;
|
import org.bitcoinj.core.Coin;
|
||||||
|
@ -28,12 +29,12 @@ import java.util.GregorianCalendar;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class OfferRestrictions {
|
public class OfferRestrictions {
|
||||||
// The date when traders who have not updated cannot take offers from updated clients and their offers become
|
// The date when traders who have not upgraded to a Tor v3 Node Address cannot take offers and their offers become
|
||||||
// invisible for updated clients.
|
// invisible.
|
||||||
private static final Date REQUIRE_UPDATE_DATE = Utilities.getUTCDate(2019, GregorianCalendar.SEPTEMBER, 19);
|
private static final Date REQUIRE_TOR_NODE_ADDRESS_V3_DATE = Utilities.getUTCDate(2021, GregorianCalendar.AUGUST, 15);
|
||||||
|
|
||||||
static boolean requiresUpdate() {
|
public static boolean requiresNodeAddressUpdate() {
|
||||||
return new Date().after(REQUIRE_UPDATE_DATE);
|
return new Date().after(REQUIRE_TOR_NODE_ADDRESS_V3_DATE) && !Config.baseCurrencyNetwork().isRegtest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Coin TOLERATED_SMALL_TRADE_AMOUNT = Coin.parseCoin("0.01");
|
public static Coin TOLERATED_SMALL_TRADE_AMOUNT = Coin.parseCoin("0.01");
|
||||||
|
|
|
@ -52,6 +52,7 @@ import bisq.network.p2p.P2PService;
|
||||||
import bisq.network.p2p.SendDirectMessageListener;
|
import bisq.network.p2p.SendDirectMessageListener;
|
||||||
import bisq.network.p2p.peers.Broadcaster;
|
import bisq.network.p2p.peers.Broadcaster;
|
||||||
import bisq.network.p2p.peers.PeerManager;
|
import bisq.network.p2p.peers.PeerManager;
|
||||||
|
import bisq.network.utils.Utils;
|
||||||
|
|
||||||
import bisq.common.Timer;
|
import bisq.common.Timer;
|
||||||
import bisq.common.UserThread;
|
import bisq.common.UserThread;
|
||||||
|
@ -598,6 +599,13 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
String errorMessage = null;
|
String errorMessage = null;
|
||||||
|
|
||||||
|
if (OfferRestrictions.requiresNodeAddressUpdate() && !Utils.isV3Address(peer.getHostName())) {
|
||||||
|
errorMessage = "We got a handleOfferAvailabilityRequest from a Tor node v2 address where a Tor node v3 address is required.";
|
||||||
|
log.info(errorMessage);
|
||||||
|
sendAckMessage(request, peer, false, errorMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!p2PService.isBootstrapped()) {
|
if (!p2PService.isBootstrapped()) {
|
||||||
errorMessage = "We got a handleOfferAvailabilityRequest but we have not bootstrapped yet.";
|
errorMessage = "We got a handleOfferAvailabilityRequest but we have not bootstrapped yet.";
|
||||||
log.info(errorMessage);
|
log.info(errorMessage);
|
||||||
|
|
|
@ -980,6 +980,7 @@ portfolio.pending.failedTrade.txChainValid.moveToFailed=The trade protocol encou
|
||||||
portfolio.pending.failedTrade.moveTradeToFailedIcon.tooltip=Move trade to failed trades
|
portfolio.pending.failedTrade.moveTradeToFailedIcon.tooltip=Move trade to failed trades
|
||||||
portfolio.pending.failedTrade.warningIcon.tooltip=Click to open details about the issues of this trade
|
portfolio.pending.failedTrade.warningIcon.tooltip=Click to open details about the issues of this trade
|
||||||
portfolio.failed.revertToPending.popup=Do you want to move this trade to open trades?
|
portfolio.failed.revertToPending.popup=Do you want to move this trade to open trades?
|
||||||
|
portfolio.failed.revertToPending.failed=Failed to move this trade to open trades.
|
||||||
portfolio.failed.revertToPending=Move trade to open trades
|
portfolio.failed.revertToPending=Move trade to open trades
|
||||||
|
|
||||||
portfolio.closed.completed=Completed
|
portfolio.closed.completed=Completed
|
||||||
|
@ -1111,6 +1112,7 @@ support.sigCheck.popup.failed=Signature verification failed
|
||||||
support.sigCheck.popup.invalidFormat=Message is not of expected format. Copy & paste summary message from dispute.
|
support.sigCheck.popup.invalidFormat=Message is not of expected format. Copy & paste summary message from dispute.
|
||||||
|
|
||||||
support.reOpenByTrader.prompt=Are you sure you want to re-open the dispute?
|
support.reOpenByTrader.prompt=Are you sure you want to re-open the dispute?
|
||||||
|
support.reOpenByTrader.failed=Failed to re-open the dispute.
|
||||||
support.reOpenButton.label=Re-open
|
support.reOpenButton.label=Re-open
|
||||||
support.sendNotificationButton.label=Private notification
|
support.sendNotificationButton.label=Private notification
|
||||||
support.reportButton.label=Report
|
support.reportButton.label=Report
|
||||||
|
@ -2994,6 +2996,13 @@ popup.accountSigning.unsignedPubKeys.signed=Pubkeys were signed
|
||||||
popup.accountSigning.unsignedPubKeys.result.signed=Signed pubkeys
|
popup.accountSigning.unsignedPubKeys.result.signed=Signed pubkeys
|
||||||
popup.accountSigning.unsignedPubKeys.result.failed=Failed to sign
|
popup.accountSigning.unsignedPubKeys.result.failed=Failed to sign
|
||||||
|
|
||||||
|
popup.info.torMigration.msg=Your Bisq node is currently using a Tor v2 address. Tor v2 is being deprecated soon \
|
||||||
|
[HYPERLINK:https://blog.torproject.org/v2-deprecation-timeline], and \
|
||||||
|
Bisq nodes with Tor v2 addresses will no longer be able to trade on August 15th, 2021.\n\n\
|
||||||
|
Please switch your Bisq node to a Tor v3 address. It's quick and simple -- see details in this doc \
|
||||||
|
[HYPERLINK:https://bisq.wiki/Changing_your_onion_address] or in this video [HYPERLINK:https://bitcointv.com/videos/watch/f96adc20-4092-4253-84c0-1b18088b4b95]. \n\n\
|
||||||
|
Make sure to back up your data directory beforehand.
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
# Notifications
|
# Notifications
|
||||||
####################################################################
|
####################################################################
|
||||||
|
@ -3114,7 +3123,7 @@ txIdTextField.missingTx.warning.tooltip=Missing required transaction
|
||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
navigation.account=\"Account\"
|
navigation.account=\"Account\"
|
||||||
navigation.account.walletSeed=\"Account/Wallet seed\"
|
navigation.account.backup=\"Account/Backup\"
|
||||||
navigation.funds.availableForWithdrawal=\"Funds/Send funds\"
|
navigation.funds.availableForWithdrawal=\"Funds/Send funds\"
|
||||||
navigation.portfolio.myOpenOffers=\"Portfolio/My open offers\"
|
navigation.portfolio.myOpenOffers=\"Portfolio/My open offers\"
|
||||||
navigation.portfolio.pending=\"Portfolio/Open trades\"
|
navigation.portfolio.pending=\"Portfolio/Open trades\"
|
||||||
|
|
|
@ -17,10 +17,13 @@
|
||||||
|
|
||||||
package bisq.desktop.main;
|
package bisq.desktop.main;
|
||||||
|
|
||||||
|
import bisq.desktop.Navigation;
|
||||||
import bisq.desktop.app.BisqApp;
|
import bisq.desktop.app.BisqApp;
|
||||||
import bisq.desktop.common.model.ViewModel;
|
import bisq.desktop.common.model.ViewModel;
|
||||||
import bisq.desktop.components.ExplorerAddressTextField;
|
import bisq.desktop.components.ExplorerAddressTextField;
|
||||||
import bisq.desktop.components.TxIdTextField;
|
import bisq.desktop.components.TxIdTextField;
|
||||||
|
import bisq.desktop.main.account.AccountView;
|
||||||
|
import bisq.desktop.main.account.content.backup.BackupView;
|
||||||
import bisq.desktop.main.overlays.Overlay;
|
import bisq.desktop.main.overlays.Overlay;
|
||||||
import bisq.desktop.main.overlays.notifications.NotificationCenter;
|
import bisq.desktop.main.overlays.notifications.NotificationCenter;
|
||||||
import bisq.desktop.main.overlays.popups.Popup;
|
import bisq.desktop.main.overlays.popups.Popup;
|
||||||
|
@ -136,6 +139,7 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupListener {
|
||||||
@Getter
|
@Getter
|
||||||
private final TorNetworkSettingsWindow torNetworkSettingsWindow;
|
private final TorNetworkSettingsWindow torNetworkSettingsWindow;
|
||||||
private final CorruptedStorageFileHandler corruptedStorageFileHandler;
|
private final CorruptedStorageFileHandler corruptedStorageFileHandler;
|
||||||
|
private final Navigation navigation;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final BooleanProperty showAppScreen = new SimpleBooleanProperty();
|
private final BooleanProperty showAppScreen = new SimpleBooleanProperty();
|
||||||
|
@ -179,7 +183,8 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupListener {
|
||||||
LocalBitcoinNode localBitcoinNode,
|
LocalBitcoinNode localBitcoinNode,
|
||||||
AccountAgeWitnessService accountAgeWitnessService,
|
AccountAgeWitnessService accountAgeWitnessService,
|
||||||
TorNetworkSettingsWindow torNetworkSettingsWindow,
|
TorNetworkSettingsWindow torNetworkSettingsWindow,
|
||||||
CorruptedStorageFileHandler corruptedStorageFileHandler) {
|
CorruptedStorageFileHandler corruptedStorageFileHandler,
|
||||||
|
Navigation navigation) {
|
||||||
this.bisqSetup = bisqSetup;
|
this.bisqSetup = bisqSetup;
|
||||||
this.walletsSetup = walletsSetup;
|
this.walletsSetup = walletsSetup;
|
||||||
this.user = user;
|
this.user = user;
|
||||||
|
@ -204,6 +209,7 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupListener {
|
||||||
this.accountAgeWitnessService = accountAgeWitnessService;
|
this.accountAgeWitnessService = accountAgeWitnessService;
|
||||||
this.torNetworkSettingsWindow = torNetworkSettingsWindow;
|
this.torNetworkSettingsWindow = torNetworkSettingsWindow;
|
||||||
this.corruptedStorageFileHandler = corruptedStorageFileHandler;
|
this.corruptedStorageFileHandler = corruptedStorageFileHandler;
|
||||||
|
this.navigation = navigation;
|
||||||
|
|
||||||
TxIdTextField.setPreferences(preferences);
|
TxIdTextField.setPreferences(preferences);
|
||||||
ExplorerAddressTextField.setPreferences(preferences);
|
ExplorerAddressTextField.setPreferences(preferences);
|
||||||
|
@ -417,6 +423,13 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupListener {
|
||||||
.hideCloseButton()
|
.hideCloseButton()
|
||||||
.show());
|
.show());
|
||||||
|
|
||||||
|
bisqSetup.setTorAddressUpgradeHandler(() -> new Popup().information(Res.get("popup.info.torMigration.msg"))
|
||||||
|
.actionButtonTextWithGoTo("navigation.account.backup")
|
||||||
|
.onAction(() -> {
|
||||||
|
navigation.setReturnPath(navigation.getCurrentPath());
|
||||||
|
navigation.navigateTo(MainView.class, AccountView.class, BackupView.class);
|
||||||
|
}).show());
|
||||||
|
|
||||||
corruptedStorageFileHandler.getFiles().ifPresent(files -> new Popup()
|
corruptedStorageFileHandler.getFiles().ifPresent(files -> new Popup()
|
||||||
.warning(Res.get("popup.warning.incompatibleDB", files.toString(), config.appDataDir))
|
.warning(Res.get("popup.warning.incompatibleDB", files.toString(), config.appDataDir))
|
||||||
.useShutDownButton()
|
.useShutDownButton()
|
||||||
|
|
|
@ -20,8 +20,11 @@ package bisq.desktop.main.offer.offerbook;
|
||||||
import bisq.core.filter.FilterManager;
|
import bisq.core.filter.FilterManager;
|
||||||
import bisq.core.offer.Offer;
|
import bisq.core.offer.Offer;
|
||||||
import bisq.core.offer.OfferBookService;
|
import bisq.core.offer.OfferBookService;
|
||||||
|
import bisq.core.offer.OfferRestrictions;
|
||||||
import bisq.core.trade.TradeManager;
|
import bisq.core.trade.TradeManager;
|
||||||
|
|
||||||
|
import bisq.network.utils.Utils;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
@ -75,6 +78,11 @@ public class OfferBook {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (OfferRestrictions.requiresNodeAddressUpdate() && !Utils.isV3Address(offer.getMakerNodeAddress().getHostName())) {
|
||||||
|
log.debug("Ignored offer with Tor v2 node address. ID={}", offer.getId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boolean hasSameOffer = offerBookListItems.stream()
|
boolean hasSameOffer = offerBookListItems.stream()
|
||||||
.anyMatch(item -> item.getOffer().equals(offer));
|
.anyMatch(item -> item.getOffer().equals(offer));
|
||||||
if (!hasSameOffer) {
|
if (!hasSameOffer) {
|
||||||
|
@ -126,6 +134,7 @@ public class OfferBook {
|
||||||
offerBookListItems.clear();
|
offerBookListItems.clear();
|
||||||
offerBookListItems.addAll(offerBookService.getOffers().stream()
|
offerBookListItems.addAll(offerBookService.getOffers().stream()
|
||||||
.filter(o -> !filterManager.isOfferIdBanned(o.getId()))
|
.filter(o -> !filterManager.isOfferIdBanned(o.getId()))
|
||||||
|
.filter(o -> !OfferRestrictions.requiresNodeAddressUpdate() || Utils.isV3Address(o.getMakerNodeAddress().getHostName()))
|
||||||
.map(OfferBookListItem::new)
|
.map(OfferBookListItem::new)
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
|
|
||||||
|
|
|
@ -25,26 +25,39 @@ import bisq.core.trade.Trade;
|
||||||
import bisq.core.trade.TradeManager;
|
import bisq.core.trade.TradeManager;
|
||||||
import bisq.core.trade.failed.FailedTradesManager;
|
import bisq.core.trade.failed.FailedTradesManager;
|
||||||
|
|
||||||
|
import bisq.network.p2p.NodeAddress;
|
||||||
|
import bisq.network.p2p.P2PService;
|
||||||
|
|
||||||
|
import bisq.common.crypto.KeyRing;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ListChangeListener;
|
import javafx.collections.ListChangeListener;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
class FailedTradesDataModel extends ActivatableDataModel {
|
class FailedTradesDataModel extends ActivatableDataModel {
|
||||||
|
|
||||||
private final FailedTradesManager failedTradesManager;
|
private final FailedTradesManager failedTradesManager;
|
||||||
private final TradeManager tradeManager;
|
private final TradeManager tradeManager;
|
||||||
|
private final P2PService p2PService;
|
||||||
|
private final KeyRing keyRing;
|
||||||
|
|
||||||
private final ObservableList<FailedTradesListItem> list = FXCollections.observableArrayList();
|
private final ObservableList<FailedTradesListItem> list = FXCollections.observableArrayList();
|
||||||
private final ListChangeListener<Trade> tradesListChangeListener;
|
private final ListChangeListener<Trade> tradesListChangeListener;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public FailedTradesDataModel(FailedTradesManager failedTradesManager, TradeManager tradeManager) {
|
public FailedTradesDataModel(FailedTradesManager failedTradesManager,
|
||||||
|
TradeManager tradeManager,
|
||||||
|
P2PService p2PService,
|
||||||
|
KeyRing keyRing) {
|
||||||
this.failedTradesManager = failedTradesManager;
|
this.failedTradesManager = failedTradesManager;
|
||||||
this.tradeManager = tradeManager;
|
this.tradeManager = tradeManager;
|
||||||
|
this.p2PService = p2PService;
|
||||||
|
this.keyRing = keyRing;
|
||||||
|
|
||||||
tradesListChangeListener = change -> applyList();
|
tradesListChangeListener = change -> applyList();
|
||||||
}
|
}
|
||||||
|
@ -77,9 +90,19 @@ class FailedTradesDataModel extends ActivatableDataModel {
|
||||||
list.sort((o1, o2) -> o2.getTrade().getDate().compareTo(o1.getTrade().getDate()));
|
list.sort((o1, o2) -> o2.getTrade().getDate().compareTo(o1.getTrade().getDate()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onMoveTradeToPendingTrades(Trade trade) {
|
public boolean onMoveTradeToPendingTrades(Trade trade) {
|
||||||
|
if (!isTradeWithSameCurrentNodeAddress(trade)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
failedTradesManager.removeTrade(trade);
|
failedTradesManager.removeTrade(trade);
|
||||||
tradeManager.addFailedTradeToPendingTrades(trade);
|
tradeManager.addFailedTradeToPendingTrades(trade);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isTradeWithSameCurrentNodeAddress(Trade trade) {
|
||||||
|
NodeAddress tradeNodeAddress = trade.getContract().getMyNodeAddress(keyRing.getPubKeyRing());
|
||||||
|
return Objects.equals(p2PService.getNetworkNode().getNodeAddress(), tradeNodeAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unfailTrade(Trade trade) {
|
public void unfailTrade(Trade trade) {
|
||||||
|
|
|
@ -334,14 +334,18 @@ public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTrades
|
||||||
|
|
||||||
private void onRevertTrade(Trade trade) {
|
private void onRevertTrade(Trade trade) {
|
||||||
new Popup().attention(Res.get("portfolio.failed.revertToPending.popup"))
|
new Popup().attention(Res.get("portfolio.failed.revertToPending.popup"))
|
||||||
.onAction(() -> onMoveTradeToPendingTrades(trade))
|
.onAction(() -> {
|
||||||
|
if (!onMoveTradeToPendingTrades(trade)) {
|
||||||
|
new Popup().warning(Res.get("portfolio.failed.revertToPending.failed")).show();
|
||||||
|
}
|
||||||
|
})
|
||||||
.actionButtonText(Res.get("shared.yes"))
|
.actionButtonText(Res.get("shared.yes"))
|
||||||
.closeButtonText(Res.get("shared.no"))
|
.closeButtonText(Res.get("shared.no"))
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onMoveTradeToPendingTrades(Trade trade) {
|
private boolean onMoveTradeToPendingTrades(Trade trade) {
|
||||||
model.dataModel.onMoveTradeToPendingTrades(trade);
|
return model.dataModel.onMoveTradeToPendingTrades(trade);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTradeIdColumnCellFactory() {
|
private void setTradeIdColumnCellFactory() {
|
||||||
|
|
|
@ -58,6 +58,5 @@ public class SettingsPresentation {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setup() {
|
public void setup() {
|
||||||
showNotification.set(preferences.showAgain(SETTINGS_NEWS));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ import bisq.core.alert.PrivateNotificationManager;
|
||||||
import bisq.core.dao.DaoFacade;
|
import bisq.core.dao.DaoFacade;
|
||||||
import bisq.core.locale.CurrencyUtil;
|
import bisq.core.locale.CurrencyUtil;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
|
import bisq.core.offer.OfferRestrictions;
|
||||||
import bisq.core.support.SupportType;
|
import bisq.core.support.SupportType;
|
||||||
import bisq.core.support.dispute.Dispute;
|
import bisq.core.support.dispute.Dispute;
|
||||||
import bisq.core.support.dispute.DisputeList;
|
import bisq.core.support.dispute.DisputeList;
|
||||||
|
@ -59,6 +60,8 @@ import bisq.core.util.FormattingUtils;
|
||||||
import bisq.core.util.coin.CoinFormatter;
|
import bisq.core.util.coin.CoinFormatter;
|
||||||
|
|
||||||
import bisq.network.p2p.NodeAddress;
|
import bisq.network.p2p.NodeAddress;
|
||||||
|
import bisq.network.p2p.P2PService;
|
||||||
|
import bisq.network.utils.Utils;
|
||||||
|
|
||||||
import bisq.common.UserThread;
|
import bisq.common.UserThread;
|
||||||
import bisq.common.crypto.KeyRing;
|
import bisq.common.crypto.KeyRing;
|
||||||
|
@ -110,6 +113,7 @@ import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
@ -151,6 +155,7 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> implements
|
||||||
|
|
||||||
protected final DisputeManager<? extends DisputeList<Dispute>> disputeManager;
|
protected final DisputeManager<? extends DisputeList<Dispute>> disputeManager;
|
||||||
protected final KeyRing keyRing;
|
protected final KeyRing keyRing;
|
||||||
|
private final P2PService p2PService;
|
||||||
private final TradeManager tradeManager;
|
private final TradeManager tradeManager;
|
||||||
protected final CoinFormatter formatter;
|
protected final CoinFormatter formatter;
|
||||||
protected final Preferences preferences;
|
protected final Preferences preferences;
|
||||||
|
@ -195,6 +200,7 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> implements
|
||||||
|
|
||||||
public DisputeView(DisputeManager<? extends DisputeList<Dispute>> disputeManager,
|
public DisputeView(DisputeManager<? extends DisputeList<Dispute>> disputeManager,
|
||||||
KeyRing keyRing,
|
KeyRing keyRing,
|
||||||
|
P2PService p2PService,
|
||||||
TradeManager tradeManager,
|
TradeManager tradeManager,
|
||||||
CoinFormatter formatter,
|
CoinFormatter formatter,
|
||||||
Preferences preferences,
|
Preferences preferences,
|
||||||
|
@ -209,6 +215,7 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> implements
|
||||||
boolean useDevPrivilegeKeys) {
|
boolean useDevPrivilegeKeys) {
|
||||||
this.disputeManager = disputeManager;
|
this.disputeManager = disputeManager;
|
||||||
this.keyRing = keyRing;
|
this.keyRing = keyRing;
|
||||||
|
this.p2PService = p2PService;
|
||||||
this.tradeManager = tradeManager;
|
this.tradeManager = tradeManager;
|
||||||
this.formatter = formatter;
|
this.formatter = formatter;
|
||||||
this.preferences = preferences;
|
this.preferences = preferences;
|
||||||
|
@ -498,8 +505,9 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> implements
|
||||||
// a derived version in the ClientView for users pops up an "Are you sure" box first.
|
// a derived version in the ClientView for users pops up an "Are you sure" box first.
|
||||||
// this version includes the sending of an automatic message to the user, see addMediationReOpenedMessage
|
// this version includes the sending of an automatic message to the user, see addMediationReOpenedMessage
|
||||||
protected void reOpenDisputeFromButton() {
|
protected void reOpenDisputeFromButton() {
|
||||||
reOpenDispute();
|
if (reOpenDispute()) {
|
||||||
disputeManager.addMediationReOpenedMessage(selectedDispute, false);
|
disputeManager.addMediationReOpenedMessage(selectedDispute, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// only applicable to traders
|
// only applicable to traders
|
||||||
|
@ -520,15 +528,33 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> implements
|
||||||
// overridden by clients that use it (dispute agents)
|
// overridden by clients that use it (dispute agents)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void reOpenDispute() {
|
protected boolean reOpenDispute() {
|
||||||
if (selectedDispute != null && selectedDispute.isClosed()) {
|
if (selectedDispute != null &&
|
||||||
|
selectedDispute.isClosed() &&
|
||||||
|
isNodeAddressOk(selectedDispute,
|
||||||
|
!disputeManager.isTrader(selectedDispute))) {
|
||||||
selectedDispute.reOpen();
|
selectedDispute.reOpen();
|
||||||
handleOnProcessDispute(selectedDispute);
|
handleOnProcessDispute(selectedDispute);
|
||||||
disputeManager.requestPersistence();
|
disputeManager.requestPersistence();
|
||||||
onSelectDispute(selectedDispute);
|
onSelectDispute(selectedDispute);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
new Popup().warning(Res.get("support.reOpenByTrader.failed")).show();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isNodeAddressOk(Dispute dispute, boolean isMediator) {
|
||||||
|
NodeAddress disputeNodeAddress = isMediator ? dispute.getContract().getMediatorNodeAddress() :
|
||||||
|
dispute.getContract().getMyNodeAddress(keyRing.getPubKeyRing());
|
||||||
|
|
||||||
|
if (OfferRestrictions.requiresNodeAddressUpdate() && !Utils.isV3Address(disputeNodeAddress.getHostName())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Objects.equals(p2PService.getNetworkNode().getNodeAddress(), disputeNodeAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// UI actions
|
// UI actions
|
||||||
|
|
|
@ -40,6 +40,8 @@ import bisq.core.user.DontShowAgainLookup;
|
||||||
import bisq.core.user.Preferences;
|
import bisq.core.user.Preferences;
|
||||||
import bisq.core.util.coin.CoinFormatter;
|
import bisq.core.util.coin.CoinFormatter;
|
||||||
|
|
||||||
|
import bisq.network.p2p.P2PService;
|
||||||
|
|
||||||
import bisq.common.crypto.KeyRing;
|
import bisq.common.crypto.KeyRing;
|
||||||
import bisq.common.util.Utilities;
|
import bisq.common.util.Utilities;
|
||||||
|
|
||||||
|
@ -72,6 +74,7 @@ public abstract class DisputeAgentView extends DisputeView implements MultipleHo
|
||||||
|
|
||||||
public DisputeAgentView(DisputeManager<? extends DisputeList<Dispute>> disputeManager,
|
public DisputeAgentView(DisputeManager<? extends DisputeList<Dispute>> disputeManager,
|
||||||
KeyRing keyRing,
|
KeyRing keyRing,
|
||||||
|
P2PService p2PService,
|
||||||
TradeManager tradeManager,
|
TradeManager tradeManager,
|
||||||
CoinFormatter formatter,
|
CoinFormatter formatter,
|
||||||
Preferences preferences,
|
Preferences preferences,
|
||||||
|
@ -86,6 +89,7 @@ public abstract class DisputeAgentView extends DisputeView implements MultipleHo
|
||||||
boolean useDevPrivilegeKeys) {
|
boolean useDevPrivilegeKeys) {
|
||||||
super(disputeManager,
|
super(disputeManager,
|
||||||
keyRing,
|
keyRing,
|
||||||
|
p2PService,
|
||||||
tradeManager,
|
tradeManager,
|
||||||
formatter,
|
formatter,
|
||||||
preferences,
|
preferences,
|
||||||
|
|
|
@ -40,6 +40,8 @@ import bisq.core.user.Preferences;
|
||||||
import bisq.core.util.FormattingUtils;
|
import bisq.core.util.FormattingUtils;
|
||||||
import bisq.core.util.coin.CoinFormatter;
|
import bisq.core.util.coin.CoinFormatter;
|
||||||
|
|
||||||
|
import bisq.network.p2p.P2PService;
|
||||||
|
|
||||||
import bisq.common.config.Config;
|
import bisq.common.config.Config;
|
||||||
import bisq.common.crypto.KeyRing;
|
import bisq.common.crypto.KeyRing;
|
||||||
|
|
||||||
|
@ -52,6 +54,7 @@ public class ArbitratorView extends DisputeAgentView {
|
||||||
@Inject
|
@Inject
|
||||||
public ArbitratorView(ArbitrationManager arbitrationManager,
|
public ArbitratorView(ArbitrationManager arbitrationManager,
|
||||||
KeyRing keyRing,
|
KeyRing keyRing,
|
||||||
|
P2PService p2PService,
|
||||||
TradeManager tradeManager,
|
TradeManager tradeManager,
|
||||||
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
||||||
Preferences preferences,
|
Preferences preferences,
|
||||||
|
@ -66,6 +69,7 @@ public class ArbitratorView extends DisputeAgentView {
|
||||||
@Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
|
@Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
|
||||||
super(arbitrationManager,
|
super(arbitrationManager,
|
||||||
keyRing,
|
keyRing,
|
||||||
|
p2PService,
|
||||||
tradeManager,
|
tradeManager,
|
||||||
formatter,
|
formatter,
|
||||||
preferences,
|
preferences,
|
||||||
|
|
|
@ -38,6 +38,8 @@ import bisq.core.user.Preferences;
|
||||||
import bisq.core.util.FormattingUtils;
|
import bisq.core.util.FormattingUtils;
|
||||||
import bisq.core.util.coin.CoinFormatter;
|
import bisq.core.util.coin.CoinFormatter;
|
||||||
|
|
||||||
|
import bisq.network.p2p.P2PService;
|
||||||
|
|
||||||
import bisq.common.config.Config;
|
import bisq.common.config.Config;
|
||||||
import bisq.common.crypto.KeyRing;
|
import bisq.common.crypto.KeyRing;
|
||||||
|
|
||||||
|
@ -50,6 +52,7 @@ public class MediatorView extends DisputeAgentView {
|
||||||
@Inject
|
@Inject
|
||||||
public MediatorView(MediationManager mediationManager,
|
public MediatorView(MediationManager mediationManager,
|
||||||
KeyRing keyRing,
|
KeyRing keyRing,
|
||||||
|
P2PService p2PService,
|
||||||
TradeManager tradeManager,
|
TradeManager tradeManager,
|
||||||
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
||||||
Preferences preferences,
|
Preferences preferences,
|
||||||
|
@ -64,6 +67,7 @@ public class MediatorView extends DisputeAgentView {
|
||||||
@Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
|
@Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
|
||||||
super(mediationManager,
|
super(mediationManager,
|
||||||
keyRing,
|
keyRing,
|
||||||
|
p2PService,
|
||||||
tradeManager,
|
tradeManager,
|
||||||
formatter,
|
formatter,
|
||||||
preferences,
|
preferences,
|
||||||
|
|
|
@ -40,6 +40,8 @@ import bisq.core.user.Preferences;
|
||||||
import bisq.core.util.FormattingUtils;
|
import bisq.core.util.FormattingUtils;
|
||||||
import bisq.core.util.coin.CoinFormatter;
|
import bisq.core.util.coin.CoinFormatter;
|
||||||
|
|
||||||
|
import bisq.network.p2p.P2PService;
|
||||||
|
|
||||||
import bisq.common.config.Config;
|
import bisq.common.config.Config;
|
||||||
import bisq.common.crypto.KeyRing;
|
import bisq.common.crypto.KeyRing;
|
||||||
|
|
||||||
|
@ -52,6 +54,7 @@ public class RefundAgentView extends DisputeAgentView {
|
||||||
@Inject
|
@Inject
|
||||||
public RefundAgentView(RefundManager refundManager,
|
public RefundAgentView(RefundManager refundManager,
|
||||||
KeyRing keyRing,
|
KeyRing keyRing,
|
||||||
|
P2PService p2PService,
|
||||||
TradeManager tradeManager,
|
TradeManager tradeManager,
|
||||||
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
||||||
Preferences preferences,
|
Preferences preferences,
|
||||||
|
@ -66,6 +69,7 @@ public class RefundAgentView extends DisputeAgentView {
|
||||||
@Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
|
@Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
|
||||||
super(refundManager,
|
super(refundManager,
|
||||||
keyRing,
|
keyRing,
|
||||||
|
p2PService,
|
||||||
tradeManager,
|
tradeManager,
|
||||||
formatter,
|
formatter,
|
||||||
preferences,
|
preferences,
|
||||||
|
|
|
@ -34,11 +34,14 @@ import bisq.core.trade.TradeManager;
|
||||||
import bisq.core.user.Preferences;
|
import bisq.core.user.Preferences;
|
||||||
import bisq.core.util.coin.CoinFormatter;
|
import bisq.core.util.coin.CoinFormatter;
|
||||||
|
|
||||||
|
import bisq.network.p2p.P2PService;
|
||||||
|
|
||||||
import bisq.common.crypto.KeyRing;
|
import bisq.common.crypto.KeyRing;
|
||||||
|
|
||||||
public abstract class DisputeClientView extends DisputeView {
|
public abstract class DisputeClientView extends DisputeView {
|
||||||
public DisputeClientView(DisputeManager<? extends DisputeList<Dispute>> DisputeManager,
|
public DisputeClientView(DisputeManager<? extends DisputeList<Dispute>> DisputeManager,
|
||||||
KeyRing keyRing,
|
KeyRing keyRing,
|
||||||
|
P2PService p2PService,
|
||||||
TradeManager tradeManager,
|
TradeManager tradeManager,
|
||||||
CoinFormatter formatter,
|
CoinFormatter formatter,
|
||||||
Preferences preferences,
|
Preferences preferences,
|
||||||
|
@ -51,9 +54,9 @@ public abstract class DisputeClientView extends DisputeView {
|
||||||
RefundAgentManager refundAgentManager,
|
RefundAgentManager refundAgentManager,
|
||||||
DaoFacade daoFacade,
|
DaoFacade daoFacade,
|
||||||
boolean useDevPrivilegeKeys) {
|
boolean useDevPrivilegeKeys) {
|
||||||
super(DisputeManager, keyRing, tradeManager, formatter, preferences, disputeSummaryWindow, privateNotificationManager,
|
super(DisputeManager, keyRing, p2PService, tradeManager, formatter, preferences, disputeSummaryWindow,
|
||||||
contractWindow, tradeDetailsWindow, accountAgeWitnessService,
|
privateNotificationManager, contractWindow, tradeDetailsWindow,
|
||||||
mediatorManager, refundAgentManager, daoFacade, useDevPrivilegeKeys);
|
accountAgeWitnessService, mediatorManager, refundAgentManager, daoFacade, useDevPrivilegeKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -38,6 +38,8 @@ import bisq.core.user.Preferences;
|
||||||
import bisq.core.util.FormattingUtils;
|
import bisq.core.util.FormattingUtils;
|
||||||
import bisq.core.util.coin.CoinFormatter;
|
import bisq.core.util.coin.CoinFormatter;
|
||||||
|
|
||||||
|
import bisq.network.p2p.P2PService;
|
||||||
|
|
||||||
import bisq.common.config.Config;
|
import bisq.common.config.Config;
|
||||||
import bisq.common.crypto.KeyRing;
|
import bisq.common.crypto.KeyRing;
|
||||||
|
|
||||||
|
@ -49,6 +51,7 @@ public class ArbitrationClientView extends DisputeClientView {
|
||||||
@Inject
|
@Inject
|
||||||
public ArbitrationClientView(ArbitrationManager arbitrationManager,
|
public ArbitrationClientView(ArbitrationManager arbitrationManager,
|
||||||
KeyRing keyRing,
|
KeyRing keyRing,
|
||||||
|
P2PService p2PService,
|
||||||
TradeManager tradeManager,
|
TradeManager tradeManager,
|
||||||
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
||||||
Preferences preferences,
|
Preferences preferences,
|
||||||
|
@ -61,7 +64,7 @@ public class ArbitrationClientView extends DisputeClientView {
|
||||||
RefundAgentManager refundAgentManager,
|
RefundAgentManager refundAgentManager,
|
||||||
DaoFacade daoFacade,
|
DaoFacade daoFacade,
|
||||||
@Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
|
@Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
|
||||||
super(arbitrationManager, keyRing, tradeManager, formatter, preferences, disputeSummaryWindow,
|
super(arbitrationManager, keyRing, p2PService, tradeManager, formatter, preferences, disputeSummaryWindow,
|
||||||
privateNotificationManager, contractWindow, tradeDetailsWindow, accountAgeWitnessService,
|
privateNotificationManager, contractWindow, tradeDetailsWindow, accountAgeWitnessService,
|
||||||
mediatorManager, refundAgentManager, daoFacade, useDevPrivilegeKeys);
|
mediatorManager, refundAgentManager, daoFacade, useDevPrivilegeKeys);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ import bisq.core.util.FormattingUtils;
|
||||||
import bisq.core.util.coin.CoinFormatter;
|
import bisq.core.util.coin.CoinFormatter;
|
||||||
|
|
||||||
import bisq.network.p2p.NodeAddress;
|
import bisq.network.p2p.NodeAddress;
|
||||||
|
import bisq.network.p2p.P2PService;
|
||||||
|
|
||||||
import bisq.common.config.Config;
|
import bisq.common.config.Config;
|
||||||
import bisq.common.crypto.KeyRing;
|
import bisq.common.crypto.KeyRing;
|
||||||
|
@ -54,6 +55,7 @@ public class MediationClientView extends DisputeClientView {
|
||||||
@Inject
|
@Inject
|
||||||
public MediationClientView(MediationManager mediationManager,
|
public MediationClientView(MediationManager mediationManager,
|
||||||
KeyRing keyRing,
|
KeyRing keyRing,
|
||||||
|
P2PService p2PService,
|
||||||
TradeManager tradeManager,
|
TradeManager tradeManager,
|
||||||
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
||||||
Preferences preferences,
|
Preferences preferences,
|
||||||
|
@ -66,7 +68,7 @@ public class MediationClientView extends DisputeClientView {
|
||||||
RefundAgentManager refundAgentManager,
|
RefundAgentManager refundAgentManager,
|
||||||
DaoFacade daoFacade,
|
DaoFacade daoFacade,
|
||||||
@Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
|
@Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
|
||||||
super(mediationManager, keyRing, tradeManager, formatter, preferences, disputeSummaryWindow,
|
super(mediationManager, keyRing, p2PService, tradeManager, formatter, preferences, disputeSummaryWindow,
|
||||||
privateNotificationManager, contractWindow, tradeDetailsWindow, accountAgeWitnessService,
|
privateNotificationManager, contractWindow, tradeDetailsWindow, accountAgeWitnessService,
|
||||||
mediatorManager, refundAgentManager, daoFacade, useDevPrivilegeKeys);
|
mediatorManager, refundAgentManager, daoFacade, useDevPrivilegeKeys);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ import bisq.core.util.FormattingUtils;
|
||||||
import bisq.core.util.coin.CoinFormatter;
|
import bisq.core.util.coin.CoinFormatter;
|
||||||
|
|
||||||
import bisq.network.p2p.NodeAddress;
|
import bisq.network.p2p.NodeAddress;
|
||||||
|
import bisq.network.p2p.P2PService;
|
||||||
|
|
||||||
import bisq.common.config.Config;
|
import bisq.common.config.Config;
|
||||||
import bisq.common.crypto.KeyRing;
|
import bisq.common.crypto.KeyRing;
|
||||||
|
@ -52,6 +53,7 @@ public class RefundClientView extends DisputeClientView {
|
||||||
@Inject
|
@Inject
|
||||||
public RefundClientView(RefundManager refundManager,
|
public RefundClientView(RefundManager refundManager,
|
||||||
KeyRing keyRing,
|
KeyRing keyRing,
|
||||||
|
P2PService p2PService,
|
||||||
TradeManager tradeManager,
|
TradeManager tradeManager,
|
||||||
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
||||||
Preferences preferences,
|
Preferences preferences,
|
||||||
|
@ -64,7 +66,7 @@ public class RefundClientView extends DisputeClientView {
|
||||||
RefundAgentManager refundAgentManager,
|
RefundAgentManager refundAgentManager,
|
||||||
DaoFacade daoFacade,
|
DaoFacade daoFacade,
|
||||||
@Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
|
@Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
|
||||||
super(refundManager, keyRing, tradeManager, formatter, preferences, disputeSummaryWindow,
|
super(refundManager, keyRing, p2PService, tradeManager, formatter, preferences, disputeSummaryWindow,
|
||||||
privateNotificationManager, contractWindow, tradeDetailsWindow, accountAgeWitnessService,
|
privateNotificationManager, contractWindow, tradeDetailsWindow, accountAgeWitnessService,
|
||||||
mediatorManager, refundAgentManager, daoFacade, useDevPrivilegeKeys);
|
mediatorManager, refundAgentManager, daoFacade, useDevPrivilegeKeys);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,4 +34,8 @@ public class Utils {
|
||||||
return new Random().nextInt(10000) + 50000;
|
return new Random().nextInt(10000) + 50000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isV3Address(String address) {
|
||||||
|
return address.matches("[a-z2-7]{56}.onion");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
36
p2p/src/test/java/bisq/network/utils/UtilsTest.java
Normal file
36
p2p/src/test/java/bisq/network/utils/UtilsTest.java
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Bisq.
|
||||||
|
*
|
||||||
|
* Bisq is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* Bisq is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||||
|
* License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package bisq.network.utils;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
public class UtilsTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void checkV2Address() {
|
||||||
|
assertFalse(Utils.isV3Address("xmh57jrzrnw6insl.onion"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void checkV3Address() {
|
||||||
|
assertTrue(Utils.isV3Address("vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd.onion"));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue