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:
sqrrm 2021-06-23 13:41:03 +02:00 committed by GitHub
commit 8bc60d0909
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 227 additions and 29 deletions

View file

@ -102,6 +102,7 @@ public class BisqHeadlessApp implements HeadlessApp {
gracefulShutDownHandler.gracefulShutDown(() -> {
});
});
bisqSetup.setTorAddressUpgradeHandler(() -> log.info("setTorAddressUpgradeHandler"));
corruptedStorageFileHandler.getFiles().ifPresent(files -> log.warn("getCorruptedDatabaseFiles. files={}", files));
tradeManager.setTakeOfferRequestErrorMessageHandler(errorMessage -> log.error("onTakeOfferRequestErrorMessageHandler"));

View file

@ -37,6 +37,10 @@ import bisq.core.payment.AmazonGiftCardAccount;
import bisq.core.payment.PaymentAccount;
import bisq.core.payment.RevolutAccount;
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.TradeTxException;
import bisq.core.user.Preferences;
@ -47,6 +51,7 @@ import bisq.core.util.coin.CoinFormatter;
import bisq.network.Socks5ProxyProvider;
import bisq.network.p2p.P2PService;
import bisq.network.p2p.storage.payload.PersistableNetworkPayload;
import bisq.network.utils.Utils;
import bisq.common.Timer;
import bisq.common.UserThread;
@ -84,6 +89,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Scanner;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@ -135,10 +141,12 @@ public class BisqSetup {
private final UnconfirmedBsqChangeOutputListService unconfirmedBsqChangeOutputListService;
private final Config config;
private final AccountAgeWitnessService accountAgeWitnessService;
private final TorSetup torSetup;
private final CoinFormatter formatter;
private final LocalBitcoinNode localBitcoinNode;
private final AppStartupState appStartupState;
private final MediationManager mediationManager;
private final RefundManager refundManager;
private final ArbitrationManager arbitrationManager;
@Setter
@Nullable
@ -189,6 +197,9 @@ public class BisqSetup {
private Runnable daoRequiresRestartHandler;
@Setter
@Nullable
private Runnable torAddressUpgradeHandler;
@Setter
@Nullable
private Consumer<String> downGradePreventionHandler;
@Getter
@ -217,11 +228,13 @@ public class BisqSetup {
UnconfirmedBsqChangeOutputListService unconfirmedBsqChangeOutputListService,
Config config,
AccountAgeWitnessService accountAgeWitnessService,
TorSetup torSetup,
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
LocalBitcoinNode localBitcoinNode,
AppStartupState appStartupState,
Socks5ProxyProvider socks5ProxyProvider) {
Socks5ProxyProvider socks5ProxyProvider,
MediationManager mediationManager,
RefundManager refundManager,
ArbitrationManager arbitrationManager) {
this.domainInitialisation = domainInitialisation;
this.p2PNetworkSetup = p2PNetworkSetup;
this.walletAppSetup = walletAppSetup;
@ -238,10 +251,12 @@ public class BisqSetup {
this.unconfirmedBsqChangeOutputListService = unconfirmedBsqChangeOutputListService;
this.config = config;
this.accountAgeWitnessService = accountAgeWitnessService;
this.torSetup = torSetup;
this.formatter = formatter;
this.localBitcoinNode = localBitcoinNode;
this.appStartupState = appStartupState;
this.mediationManager = mediationManager;
this.refundManager = refundManager;
this.arbitrationManager = arbitrationManager;
MemPoolSpaceTxBroadcaster.init(socks5ProxyProvider, preferences, localBitcoinNode);
}
@ -312,6 +327,7 @@ public class BisqSetup {
maybeShowSecurityRecommendation();
maybeShowLocalhostRunningInfo();
maybeShowAccountSigningStateInfo();
maybeShowTorAddressUpgradeInformation();
}
@ -563,8 +579,6 @@ public class BisqSetup {
}
private static File getVersionFile() {
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

View file

@ -19,6 +19,7 @@ package bisq.core.offer;
import bisq.common.app.Capabilities;
import bisq.common.app.Capability;
import bisq.common.config.Config;
import bisq.common.util.Utilities;
import org.bitcoinj.core.Coin;
@ -28,12 +29,12 @@ import java.util.GregorianCalendar;
import java.util.Map;
public class OfferRestrictions {
// The date when traders who have not updated cannot take offers from updated clients and their offers become
// invisible for updated clients.
private static final Date REQUIRE_UPDATE_DATE = Utilities.getUTCDate(2019, GregorianCalendar.SEPTEMBER, 19);
// The date when traders who have not upgraded to a Tor v3 Node Address cannot take offers and their offers become
// invisible.
private static final Date REQUIRE_TOR_NODE_ADDRESS_V3_DATE = Utilities.getUTCDate(2021, GregorianCalendar.AUGUST, 15);
static boolean requiresUpdate() {
return new Date().after(REQUIRE_UPDATE_DATE);
public static boolean requiresNodeAddressUpdate() {
return new Date().after(REQUIRE_TOR_NODE_ADDRESS_V3_DATE) && !Config.baseCurrencyNetwork().isRegtest();
}
public static Coin TOLERATED_SMALL_TRADE_AMOUNT = Coin.parseCoin("0.01");

View file

@ -52,6 +52,7 @@ import bisq.network.p2p.P2PService;
import bisq.network.p2p.SendDirectMessageListener;
import bisq.network.p2p.peers.Broadcaster;
import bisq.network.p2p.peers.PeerManager;
import bisq.network.utils.Utils;
import bisq.common.Timer;
import bisq.common.UserThread;
@ -598,6 +599,13 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
boolean result = false;
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()) {
errorMessage = "We got a handleOfferAvailabilityRequest but we have not bootstrapped yet.";
log.info(errorMessage);

View file

@ -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.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.failed=Failed to move this trade to open trades.
portfolio.failed.revertToPending=Move trade to open trades
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.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.sendNotificationButton.label=Private notification
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.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
####################################################################
@ -3114,7 +3123,7 @@ txIdTextField.missingTx.warning.tooltip=Missing required transaction
####################################################################
navigation.account=\"Account\"
navigation.account.walletSeed=\"Account/Wallet seed\"
navigation.account.backup=\"Account/Backup\"
navigation.funds.availableForWithdrawal=\"Funds/Send funds\"
navigation.portfolio.myOpenOffers=\"Portfolio/My open offers\"
navigation.portfolio.pending=\"Portfolio/Open trades\"

View file

@ -17,10 +17,13 @@
package bisq.desktop.main;
import bisq.desktop.Navigation;
import bisq.desktop.app.BisqApp;
import bisq.desktop.common.model.ViewModel;
import bisq.desktop.components.ExplorerAddressTextField;
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.notifications.NotificationCenter;
import bisq.desktop.main.overlays.popups.Popup;
@ -136,6 +139,7 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupListener {
@Getter
private final TorNetworkSettingsWindow torNetworkSettingsWindow;
private final CorruptedStorageFileHandler corruptedStorageFileHandler;
private final Navigation navigation;
@Getter
private final BooleanProperty showAppScreen = new SimpleBooleanProperty();
@ -179,7 +183,8 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupListener {
LocalBitcoinNode localBitcoinNode,
AccountAgeWitnessService accountAgeWitnessService,
TorNetworkSettingsWindow torNetworkSettingsWindow,
CorruptedStorageFileHandler corruptedStorageFileHandler) {
CorruptedStorageFileHandler corruptedStorageFileHandler,
Navigation navigation) {
this.bisqSetup = bisqSetup;
this.walletsSetup = walletsSetup;
this.user = user;
@ -204,6 +209,7 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupListener {
this.accountAgeWitnessService = accountAgeWitnessService;
this.torNetworkSettingsWindow = torNetworkSettingsWindow;
this.corruptedStorageFileHandler = corruptedStorageFileHandler;
this.navigation = navigation;
TxIdTextField.setPreferences(preferences);
ExplorerAddressTextField.setPreferences(preferences);
@ -417,6 +423,13 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupListener {
.hideCloseButton()
.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()
.warning(Res.get("popup.warning.incompatibleDB", files.toString(), config.appDataDir))
.useShutDownButton()

View file

@ -20,8 +20,11 @@ package bisq.desktop.main.offer.offerbook;
import bisq.core.filter.FilterManager;
import bisq.core.offer.Offer;
import bisq.core.offer.OfferBookService;
import bisq.core.offer.OfferRestrictions;
import bisq.core.trade.TradeManager;
import bisq.network.utils.Utils;
import javax.inject.Inject;
import javax.inject.Singleton;
@ -75,6 +78,11 @@ public class OfferBook {
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()
.anyMatch(item -> item.getOffer().equals(offer));
if (!hasSameOffer) {
@ -126,6 +134,7 @@ public class OfferBook {
offerBookListItems.clear();
offerBookListItems.addAll(offerBookService.getOffers().stream()
.filter(o -> !filterManager.isOfferIdBanned(o.getId()))
.filter(o -> !OfferRestrictions.requiresNodeAddressUpdate() || Utils.isV3Address(o.getMakerNodeAddress().getHostName()))
.map(OfferBookListItem::new)
.collect(Collectors.toList()));

View file

@ -25,26 +25,39 @@ import bisq.core.trade.Trade;
import bisq.core.trade.TradeManager;
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 javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import java.util.Objects;
import java.util.stream.Collectors;
class FailedTradesDataModel extends ActivatableDataModel {
private final FailedTradesManager failedTradesManager;
private final TradeManager tradeManager;
private final P2PService p2PService;
private final KeyRing keyRing;
private final ObservableList<FailedTradesListItem> list = FXCollections.observableArrayList();
private final ListChangeListener<Trade> tradesListChangeListener;
@Inject
public FailedTradesDataModel(FailedTradesManager failedTradesManager, TradeManager tradeManager) {
public FailedTradesDataModel(FailedTradesManager failedTradesManager,
TradeManager tradeManager,
P2PService p2PService,
KeyRing keyRing) {
this.failedTradesManager = failedTradesManager;
this.tradeManager = tradeManager;
this.p2PService = p2PService;
this.keyRing = keyRing;
tradesListChangeListener = change -> applyList();
}
@ -77,9 +90,19 @@ class FailedTradesDataModel extends ActivatableDataModel {
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);
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) {

View file

@ -334,14 +334,18 @@ public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTrades
private void onRevertTrade(Trade trade) {
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"))
.closeButtonText(Res.get("shared.no"))
.show();
}
private void onMoveTradeToPendingTrades(Trade trade) {
model.dataModel.onMoveTradeToPendingTrades(trade);
private boolean onMoveTradeToPendingTrades(Trade trade) {
return model.dataModel.onMoveTradeToPendingTrades(trade);
}
private void setTradeIdColumnCellFactory() {

View file

@ -58,6 +58,5 @@ public class SettingsPresentation {
}
public void setup() {
showNotification.set(preferences.showAgain(SETTINGS_NEWS));
}
}

View file

@ -40,6 +40,7 @@ import bisq.core.alert.PrivateNotificationManager;
import bisq.core.dao.DaoFacade;
import bisq.core.locale.CurrencyUtil;
import bisq.core.locale.Res;
import bisq.core.offer.OfferRestrictions;
import bisq.core.support.SupportType;
import bisq.core.support.dispute.Dispute;
import bisq.core.support.dispute.DisputeList;
@ -59,6 +60,8 @@ import bisq.core.util.FormattingUtils;
import bisq.core.util.coin.CoinFormatter;
import bisq.network.p2p.NodeAddress;
import bisq.network.p2p.P2PService;
import bisq.network.utils.Utils;
import bisq.common.UserThread;
import bisq.common.crypto.KeyRing;
@ -110,6 +113,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
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 KeyRing keyRing;
private final P2PService p2PService;
private final TradeManager tradeManager;
protected final CoinFormatter formatter;
protected final Preferences preferences;
@ -195,6 +200,7 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> implements
public DisputeView(DisputeManager<? extends DisputeList<Dispute>> disputeManager,
KeyRing keyRing,
P2PService p2PService,
TradeManager tradeManager,
CoinFormatter formatter,
Preferences preferences,
@ -209,6 +215,7 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> implements
boolean useDevPrivilegeKeys) {
this.disputeManager = disputeManager;
this.keyRing = keyRing;
this.p2PService = p2PService;
this.tradeManager = tradeManager;
this.formatter = formatter;
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.
// this version includes the sending of an automatic message to the user, see addMediationReOpenedMessage
protected void reOpenDisputeFromButton() {
reOpenDispute();
disputeManager.addMediationReOpenedMessage(selectedDispute, false);
if (reOpenDispute()) {
disputeManager.addMediationReOpenedMessage(selectedDispute, false);
}
}
// 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)
}
protected void reOpenDispute() {
if (selectedDispute != null && selectedDispute.isClosed()) {
protected boolean reOpenDispute() {
if (selectedDispute != null &&
selectedDispute.isClosed() &&
isNodeAddressOk(selectedDispute,
!disputeManager.isTrader(selectedDispute))) {
selectedDispute.reOpen();
handleOnProcessDispute(selectedDispute);
disputeManager.requestPersistence();
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

View file

@ -40,6 +40,8 @@ import bisq.core.user.DontShowAgainLookup;
import bisq.core.user.Preferences;
import bisq.core.util.coin.CoinFormatter;
import bisq.network.p2p.P2PService;
import bisq.common.crypto.KeyRing;
import bisq.common.util.Utilities;
@ -72,6 +74,7 @@ public abstract class DisputeAgentView extends DisputeView implements MultipleHo
public DisputeAgentView(DisputeManager<? extends DisputeList<Dispute>> disputeManager,
KeyRing keyRing,
P2PService p2PService,
TradeManager tradeManager,
CoinFormatter formatter,
Preferences preferences,
@ -86,6 +89,7 @@ public abstract class DisputeAgentView extends DisputeView implements MultipleHo
boolean useDevPrivilegeKeys) {
super(disputeManager,
keyRing,
p2PService,
tradeManager,
formatter,
preferences,

View file

@ -40,6 +40,8 @@ import bisq.core.user.Preferences;
import bisq.core.util.FormattingUtils;
import bisq.core.util.coin.CoinFormatter;
import bisq.network.p2p.P2PService;
import bisq.common.config.Config;
import bisq.common.crypto.KeyRing;
@ -52,6 +54,7 @@ public class ArbitratorView extends DisputeAgentView {
@Inject
public ArbitratorView(ArbitrationManager arbitrationManager,
KeyRing keyRing,
P2PService p2PService,
TradeManager tradeManager,
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
Preferences preferences,
@ -66,6 +69,7 @@ public class ArbitratorView extends DisputeAgentView {
@Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
super(arbitrationManager,
keyRing,
p2PService,
tradeManager,
formatter,
preferences,

View file

@ -38,6 +38,8 @@ import bisq.core.user.Preferences;
import bisq.core.util.FormattingUtils;
import bisq.core.util.coin.CoinFormatter;
import bisq.network.p2p.P2PService;
import bisq.common.config.Config;
import bisq.common.crypto.KeyRing;
@ -50,6 +52,7 @@ public class MediatorView extends DisputeAgentView {
@Inject
public MediatorView(MediationManager mediationManager,
KeyRing keyRing,
P2PService p2PService,
TradeManager tradeManager,
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
Preferences preferences,
@ -64,6 +67,7 @@ public class MediatorView extends DisputeAgentView {
@Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
super(mediationManager,
keyRing,
p2PService,
tradeManager,
formatter,
preferences,

View file

@ -40,6 +40,8 @@ import bisq.core.user.Preferences;
import bisq.core.util.FormattingUtils;
import bisq.core.util.coin.CoinFormatter;
import bisq.network.p2p.P2PService;
import bisq.common.config.Config;
import bisq.common.crypto.KeyRing;
@ -52,6 +54,7 @@ public class RefundAgentView extends DisputeAgentView {
@Inject
public RefundAgentView(RefundManager refundManager,
KeyRing keyRing,
P2PService p2PService,
TradeManager tradeManager,
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
Preferences preferences,
@ -66,6 +69,7 @@ public class RefundAgentView extends DisputeAgentView {
@Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) {
super(refundManager,
keyRing,
p2PService,
tradeManager,
formatter,
preferences,

View file

@ -34,11 +34,14 @@ import bisq.core.trade.TradeManager;
import bisq.core.user.Preferences;
import bisq.core.util.coin.CoinFormatter;
import bisq.network.p2p.P2PService;
import bisq.common.crypto.KeyRing;
public abstract class DisputeClientView extends DisputeView {
public DisputeClientView(DisputeManager<? extends DisputeList<Dispute>> DisputeManager,
KeyRing keyRing,
P2PService p2PService,
TradeManager tradeManager,
CoinFormatter formatter,
Preferences preferences,
@ -51,9 +54,9 @@ public abstract class DisputeClientView extends DisputeView {
RefundAgentManager refundAgentManager,
DaoFacade daoFacade,
boolean useDevPrivilegeKeys) {
super(DisputeManager, keyRing, tradeManager, formatter, preferences, disputeSummaryWindow, privateNotificationManager,
contractWindow, tradeDetailsWindow, accountAgeWitnessService,
mediatorManager, refundAgentManager, daoFacade, useDevPrivilegeKeys);
super(DisputeManager, keyRing, p2PService, tradeManager, formatter, preferences, disputeSummaryWindow,
privateNotificationManager, contractWindow, tradeDetailsWindow,
accountAgeWitnessService, mediatorManager, refundAgentManager, daoFacade, useDevPrivilegeKeys);
}
@Override

View file

@ -38,6 +38,8 @@ import bisq.core.user.Preferences;
import bisq.core.util.FormattingUtils;
import bisq.core.util.coin.CoinFormatter;
import bisq.network.p2p.P2PService;
import bisq.common.config.Config;
import bisq.common.crypto.KeyRing;
@ -49,6 +51,7 @@ public class ArbitrationClientView extends DisputeClientView {
@Inject
public ArbitrationClientView(ArbitrationManager arbitrationManager,
KeyRing keyRing,
P2PService p2PService,
TradeManager tradeManager,
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
Preferences preferences,
@ -61,7 +64,7 @@ public class ArbitrationClientView extends DisputeClientView {
RefundAgentManager refundAgentManager,
DaoFacade daoFacade,
@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,
mediatorManager, refundAgentManager, daoFacade, useDevPrivilegeKeys);
}

View file

@ -42,6 +42,7 @@ import bisq.core.util.FormattingUtils;
import bisq.core.util.coin.CoinFormatter;
import bisq.network.p2p.NodeAddress;
import bisq.network.p2p.P2PService;
import bisq.common.config.Config;
import bisq.common.crypto.KeyRing;
@ -54,6 +55,7 @@ public class MediationClientView extends DisputeClientView {
@Inject
public MediationClientView(MediationManager mediationManager,
KeyRing keyRing,
P2PService p2PService,
TradeManager tradeManager,
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
Preferences preferences,
@ -66,7 +68,7 @@ public class MediationClientView extends DisputeClientView {
RefundAgentManager refundAgentManager,
DaoFacade daoFacade,
@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,
mediatorManager, refundAgentManager, daoFacade, useDevPrivilegeKeys);
}

View file

@ -40,6 +40,7 @@ import bisq.core.util.FormattingUtils;
import bisq.core.util.coin.CoinFormatter;
import bisq.network.p2p.NodeAddress;
import bisq.network.p2p.P2PService;
import bisq.common.config.Config;
import bisq.common.crypto.KeyRing;
@ -52,6 +53,7 @@ public class RefundClientView extends DisputeClientView {
@Inject
public RefundClientView(RefundManager refundManager,
KeyRing keyRing,
P2PService p2PService,
TradeManager tradeManager,
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
Preferences preferences,
@ -64,7 +66,7 @@ public class RefundClientView extends DisputeClientView {
RefundAgentManager refundAgentManager,
DaoFacade daoFacade,
@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,
mediatorManager, refundAgentManager, daoFacade, useDevPrivilegeKeys);
}

View file

@ -34,4 +34,8 @@ public class Utils {
return new Random().nextInt(10000) + 50000;
}
}
public static boolean isV3Address(String address) {
return address.matches("[a-z2-7]{56}.onion");
}
}

View 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"));
}
}