diff --git a/src/main/java/com/sparrowwallet/sparrow/AppServices.java b/src/main/java/com/sparrowwallet/sparrow/AppServices.java index 203a20a7..cb586fa6 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppServices.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppServices.java @@ -373,6 +373,10 @@ public class AppServices { return Tor.getDefault() != null; } + public static boolean isUsingProxy() { + return isTorRunning() || Config.get().isUseProxy(); + } + public static Proxy getProxy() { return getProxy(TOR_DEFAULT_PROXY_CIRCUIT_ID); } diff --git a/src/main/java/com/sparrowwallet/sparrow/net/ElectrumServer.java b/src/main/java/com/sparrowwallet/sparrow/net/ElectrumServer.java index 75881ddd..fbc21942 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/ElectrumServer.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/ElectrumServer.java @@ -1328,7 +1328,7 @@ public class ElectrumServer { return new Task<>() { protected Sha256Hash call() throws ServerException { //If Tor proxy is configured, try all external broadcast sources in random order before falling back to connected Electrum server - if(AppServices.getProxy() != null) { + if(AppServices.isUsingProxy()) { List broadcastSources = Arrays.stream(BroadcastSource.values()).filter(src -> src.getSupportedNetworks().contains(Network.get())).collect(Collectors.toList()); Sha256Hash txid = null; for(int i = 1; !broadcastSources.isEmpty(); i++) { diff --git a/src/main/java/com/sparrowwallet/sparrow/net/FeeRatesSource.java b/src/main/java/com/sparrowwallet/sparrow/net/FeeRatesSource.java index 6ec9216e..f359ca29 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/FeeRatesSource.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/FeeRatesSource.java @@ -25,7 +25,7 @@ public enum FeeRatesSource { MEMPOOL_SPACE("mempool.space") { @Override public Map getBlockTargetFeeRates(Map defaultblockTargetFeeRates) { - String url = "https://mempool.space/api/v1/fees/recommended"; + String url = AppServices.isUsingProxy() ? "http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion/api/v1/fees/recommended" : "https://mempool.space/api/v1/fees/recommended"; return getThreeTierFeeRates(defaultblockTargetFeeRates, url); } },