diff --git a/src/main/java/com/sparrowwallet/sparrow/AppServices.java b/src/main/java/com/sparrowwallet/sparrow/AppServices.java index f5a020b3..48bf23bc 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppServices.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppServices.java @@ -209,6 +209,12 @@ public class AppServices { onlineProperty.setValue(false); onlineProperty.addListener(onlineServicesListener); + if(Config.get().getServerType() == ServerType.PUBLIC_ELECTRUM_SERVER) { + List otherServers = Arrays.stream(PublicElectrumServer.values()).map(PublicElectrumServer::getUrl).filter(url -> !url.equals(Config.get().getPublicElectrumServer())).collect(Collectors.toList()); + Config.get().setPublicElectrumServer(otherServers.get(new Random().nextInt(otherServers.size()))); + restartService(connectionService); + } + log.debug("Connection failed", failEvent.getSource().getException()); EventManager.get().post(new ConnectionFailedEvent(failEvent.getSource().getException())); }); diff --git a/src/main/java/com/sparrowwallet/sparrow/net/PublicElectrumServer.java b/src/main/java/com/sparrowwallet/sparrow/net/PublicElectrumServer.java index c4a778d0..3490beb8 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/PublicElectrumServer.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/PublicElectrumServer.java @@ -3,7 +3,9 @@ package com.sparrowwallet.sparrow.net; public enum PublicElectrumServer { BLOCKSTREAM_INFO("blockstream.info", "ssl://blockstream.info:700"), ELECTRUM_BLOCKSTREAM_INFO("electrum.blockstream.info", "ssl://electrum.blockstream.info:50002"), - LUKECHILDS_CO("bitcoin.lukechilds.co", "ssl://bitcoin.lukechilds.co:50002"); + LUKECHILDS_CO("bitcoin.lukechilds.co", "ssl://bitcoin.lukechilds.co:50002"), + EMZY_DE("electrum.emzy.de", "ssl://electrum.emzy.de:50002"), + BITAROO_NET("electrum.bitaroo.net", "ssl://electrum.bitaroo.net:50002"); PublicElectrumServer(String name, String url) { this.name = name; diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/TransactionsController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/TransactionsController.java index 16f7f38b..cc14b0fc 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/TransactionsController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/TransactionsController.java @@ -215,6 +215,11 @@ public class TransactionsController extends WalletFormController implements Init walletHistoryStatus(new WalletHistoryStatusEvent(walletForm.getWallet(), false)); } + @Subscribe + private void connectionFailed(ConnectionFailedEvent event) { + walletHistoryStatus(new WalletHistoryStatusEvent(walletForm.getWallet(), false)); + } + @Subscribe public void walletUtxoStatusChanged(WalletUtxoStatusChangedEvent event) { if(event.getWallet().equals(getWalletForm().getWallet())) { diff --git a/src/main/resources/com/sparrowwallet/sparrow/preferences/server.fxml b/src/main/resources/com/sparrowwallet/sparrow/preferences/server.fxml index 86c28801..c2274548 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/preferences/server.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/preferences/server.fxml @@ -77,6 +77,8 @@ + +