mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 06:55:08 +01:00
Check existence of selected block explorer using name string comparison
After further testing, I realized I introduced a bug in commit
4f4b0f6ce9
because apparently the
ArrayList.contains() method does not properly work for
BlockChainExplorer object - to fix this I implemented a new
contains() method that uses string comparison instead
This commit is contained in:
parent
4ac5450973
commit
c0783205bb
1 changed files with 12 additions and 4 deletions
|
@ -254,14 +254,12 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
|
|||
|
||||
// if no valid Bitcoin block explorer is set, select the 1st valid Bitcoin block explorer
|
||||
ArrayList<BlockChainExplorer> btcExplorers = getBlockChainExplorers();
|
||||
BlockChainExplorer btcExplorer = getBlockChainExplorer();
|
||||
if (btcExplorer == null || btcExplorers.contains(btcExplorer) == false)
|
||||
if (!blockExplorerExists(btcExplorers, getBlockChainExplorer()))
|
||||
setBlockChainExplorer(btcExplorers.get(0));
|
||||
|
||||
// if no valid BSQ block explorer is set, randomly select a valid BSQ block explorer
|
||||
ArrayList<BlockChainExplorer> bsqExplorers = getBsqBlockChainExplorers();
|
||||
BlockChainExplorer bsqExplorer = getBsqBlockChainExplorer();
|
||||
if (bsqExplorer == null || bsqExplorers.contains(bsqExplorer) == false)
|
||||
if (!blockExplorerExists(bsqExplorers, getBsqBlockChainExplorer()))
|
||||
setBsqBlockChainExplorer(bsqExplorers.get((new Random()).nextInt(bsqExplorers.size())));
|
||||
|
||||
tradeCurrenciesAsObservable.addAll(prefPayload.getFiatCurrencies());
|
||||
|
@ -826,6 +824,16 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
|
|||
tradeCurrenciesAsObservable.remove(change.getRemoved().get(0));
|
||||
}
|
||||
|
||||
private boolean blockExplorerExists(ArrayList<BlockChainExplorer> explorers,
|
||||
BlockChainExplorer explorer)
|
||||
{
|
||||
if (explorer != null && explorers != null && explorers.size() > 0)
|
||||
for (int i = 0; i < explorers.size(); i++)
|
||||
if (explorers.get(i).name.equals(explorer.name))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private interface ExcludesDelegateMethods {
|
||||
void setTacAccepted(boolean tacAccepted);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue