diff --git a/src/main/java/com/sparrowwallet/sparrow/AppServices.java b/src/main/java/com/sparrowwallet/sparrow/AppServices.java index 58b348df..ae48f7c2 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppServices.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppServices.java @@ -812,6 +812,10 @@ public class AppServices { } public static void openBlockExplorer(String txid) { + if(Config.get().isBlockExplorerDisabled()) { + return; + } + Server blockExplorer = Config.get().getBlockExplorer() == null ? BlockExplorer.MEMPOOL_SPACE.getServer() : Config.get().getBlockExplorer(); String url = blockExplorer.getUrl(); if(url.contains("{0}")) { diff --git a/src/main/java/com/sparrowwallet/sparrow/io/Config.java b/src/main/java/com/sparrowwallet/sparrow/io/Config.java index b545972f..079a5f17 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/Config.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/Config.java @@ -151,6 +151,10 @@ public class Config { flush(); } + public boolean isBlockExplorerDisabled() { + return BlockExplorer.NONE.getServer().equals(blockExplorer); + } + public Server getBlockExplorer() { return blockExplorer; } diff --git a/src/main/java/com/sparrowwallet/sparrow/net/BlockExplorer.java b/src/main/java/com/sparrowwallet/sparrow/net/BlockExplorer.java index 4fe263bc..bfc37850 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/BlockExplorer.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/BlockExplorer.java @@ -4,7 +4,8 @@ import com.sparrowwallet.sparrow.io.Server; public enum BlockExplorer { MEMPOOL_SPACE("https://mempool.space"), - BLOCKSTREAM_INFO("https://blockstream.info"); + BLOCKSTREAM_INFO("https://blockstream.info"), + NONE("http://none"); private final Server server; diff --git a/src/main/java/com/sparrowwallet/sparrow/preferences/GeneralPreferencesController.java b/src/main/java/com/sparrowwallet/sparrow/preferences/GeneralPreferencesController.java index c6109a0d..428e885c 100644 --- a/src/main/java/com/sparrowwallet/sparrow/preferences/GeneralPreferencesController.java +++ b/src/main/java/com/sparrowwallet/sparrow/preferences/GeneralPreferencesController.java @@ -91,8 +91,8 @@ public class GeneralPreferencesController extends PreferencesDetailController { blockExplorers.setConverter(new StringConverter<>() { @Override public String toString(Server server) { - if(server == null) { - return "None Available"; + if(server == null || server == BlockExplorer.NONE.getServer()) { + return "None"; } if(server == CUSTOM_BLOCK_EXPLORER) { diff --git a/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java b/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java index 52ae5a00..f9eef160 100644 --- a/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java +++ b/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java @@ -16,6 +16,7 @@ import com.sparrowwallet.sparrow.control.*; import com.sparrowwallet.sparrow.event.*; import com.sparrowwallet.sparrow.glyphfont.FontAwesome5; import com.sparrowwallet.sparrow.glyphfont.FontAwesome5Brands; +import com.sparrowwallet.sparrow.io.Config; import com.sparrowwallet.sparrow.io.Device; import com.sparrowwallet.sparrow.net.ElectrumServer; import com.sparrowwallet.sparrow.io.Storage; @@ -818,7 +819,7 @@ public class HeadersController extends TransactionFormController implements Init size.getStyleClass().remove(UNFINALIZED_TXID_CLASS); virtualSize.getStyleClass().remove(UNFINALIZED_TXID_CLASS); feeRate.getStyleClass().remove(UNFINALIZED_TXID_CLASS); - openBlockExplorer.setDisable(false); + openBlockExplorer.setDisable(Config.get().isBlockExplorerDisabled()); } }