Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated bisq explorer settings #5137

Merged
merged 1 commit into from Feb 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions core/src/main/java/bisq/core/user/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,25 @@ private void setupPreferences() {
useStandbyModeProperty.set(prefPayload.isUseStandbyMode());
cssThemeProperty.set(prefPayload.getCssTheme());

// a list of previously-used federated explorers
// if user preference references any deprecated explorers we need to select a new valid explorer
String deprecatedExplorers = "(bsq.bisq.cc|bsq.vante.me|bsq.emzy.de|bsq.sqrrm.net|bsq.bisq.services|bsq.ninja).*";

// if no valid Bitcoin block explorer is set, select the 1st valid Bitcoin block explorer
ArrayList<BlockChainExplorer> btcExplorers = getBlockChainExplorers();
if (getBlockChainExplorer() == null || getBlockChainExplorer().name.length() == 0)
if (getBlockChainExplorer() == null ||
getBlockChainExplorer().name.length() == 0 ||
getBlockChainExplorer().name.matches(deprecatedExplorers)) {
setBlockChainExplorer(btcExplorers.get(0));
}

// if no valid BSQ block explorer is set, randomly select a valid BSQ block explorer
ArrayList<BlockChainExplorer> bsqExplorers = getBsqBlockChainExplorers();
if (getBsqBlockChainExplorer() == null || getBsqBlockChainExplorer().name.length() == 0)
if (getBsqBlockChainExplorer() == null ||
getBsqBlockChainExplorer().name.length() == 0 ||
getBsqBlockChainExplorer().name.matches(deprecatedExplorers)) {
setBsqBlockChainExplorer(bsqExplorers.get((new Random()).nextInt(bsqExplorers.size())));
}

tradeCurrenciesAsObservable.addAll(prefPayload.getFiatCurrencies());
tradeCurrenciesAsObservable.addAll(prefPayload.getCryptoCurrencies());
Expand Down