diff --git a/build.gradle b/build.gradle index 86ca0781..86d4c95a 100644 --- a/build.gradle +++ b/build.gradle @@ -124,7 +124,7 @@ dependencies { exclude group: 'org.slf4j' } implementation('com.sparrowwallet.bokmakierie:bokmakierie:1.0') - implementation('io.samourai.code.whirlpool:whirlpool-client:1.0.5') + implementation('io.samourai.code.whirlpool:whirlpool-client:1.0.6') implementation('io.samourai.code.wallet:java-http-client:2.0.2') implementation('io.reactivex.rxjava2:rxjava:2.2.15') implementation('io.reactivex.rxjava2:rxjavafx:2.2.2') diff --git a/src/main/java/com/sparrowwallet/sparrow/soroban/Soroban.java b/src/main/java/com/sparrowwallet/sparrow/soroban/Soroban.java index 30df1525..b933b40e 100644 --- a/src/main/java/com/sparrowwallet/sparrow/soroban/Soroban.java +++ b/src/main/java/com/sparrowwallet/sparrow/soroban/Soroban.java @@ -3,6 +3,7 @@ package com.sparrowwallet.sparrow.soroban; import com.samourai.soroban.client.SorobanConfig; import com.samourai.soroban.client.wallet.SorobanWalletService; import com.samourai.wallet.hd.HD_Wallet; +import com.samourai.wallet.util.ExtLibJConfig; import com.sparrowwallet.drongo.Network; import com.sparrowwallet.drongo.protocol.ScriptType; import com.sparrowwallet.drongo.wallet.Wallet; @@ -37,7 +38,8 @@ public class Soroban { } public void setHDWallet(Wallet wallet) { - NetworkParameters params = sorobanWalletService.getSorobanService().getParams(); + ExtLibJConfig extLibJConfig = sorobanWalletService.getSorobanService().getSorobanConfig().getExtLibJConfig(); + NetworkParameters params = extLibJConfig.getSamouraiNetwork().getParams(); hdWallet = Whirlpool.computeHdWallet(wallet, params); bip47Account = wallet.isMasterWallet() ? wallet.getAccountIndex() : wallet.getMasterWallet().getAccountIndex(); } diff --git a/src/main/java/com/sparrowwallet/sparrow/whirlpool/Whirlpool.java b/src/main/java/com/sparrowwallet/sparrow/whirlpool/Whirlpool.java index 4c5609c5..2b71fb9c 100644 --- a/src/main/java/com/sparrowwallet/sparrow/whirlpool/Whirlpool.java +++ b/src/main/java/com/sparrowwallet/sparrow/whirlpool/Whirlpool.java @@ -112,18 +112,6 @@ public class Whirlpool { return whirlpoolWalletConfig; } - void setOnion(boolean onion) { - if(config.isTorOnionCoordinator() ^ onion) { - try { - Field torField = WhirlpoolClientConfig.class.getDeclaredField("torOnionCoordinator"); - torField.setAccessible(true); - torField.set(config, onion); - } catch(Exception e) { - log.warn("Error changing onion on WhirlpoolWalletConfig", e); - } - } - } - private DataSourceConfig computeDataSourceConfig(Integer storedBlockHeight) { return new DataSourceConfig(SparrowMinerFeeSupplier.getInstance(), new SparrowChainSupplier(storedBlockHeight), BIP_FORMAT.PROVIDER, BIP_WALLETS.WHIRLPOOL); } diff --git a/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java b/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java index de5dd621..9bb4e43c 100644 --- a/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java +++ b/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java @@ -110,8 +110,6 @@ public class WhirlpoolServices { public void startWhirlpool(Wallet wallet, Whirlpool whirlpool, boolean notifyIfMixToMissing) { if(wallet.getMasterMixConfig().getMixOnStartup() != Boolean.FALSE) { - whirlpool.setOnion(sorobanConfig.getExtLibJConfig().isOnion()); - try { String mixToWalletId = getWhirlpoolMixToWalletId(wallet.getMasterMixConfig()); whirlpool.setMixToWallet(mixToWalletId, wallet.getMasterMixConfig().getMinMixes()); @@ -230,14 +228,6 @@ public class WhirlpoolServices { extLibJConfig.setOnion(getTorProxy() != null); getHttpClientService(); //Ensure proxy is updated - try { - Field onionField = RpcClientService.class.getDeclaredField("onion"); - onionField.setAccessible(true); - onionField.set(sorobanConfig.getRpcClientService(), getTorProxy() != null); - } catch(Exception e) { - log.warn("Error changing onion on RpcClientService", e); - } - startAllWhirlpool(); bindDebugAccelerator(); } diff --git a/src/main/java/com/sparrowwallet/sparrow/whirlpool/dataSource/SparrowDataSource.java b/src/main/java/com/sparrowwallet/sparrow/whirlpool/dataSource/SparrowDataSource.java index 698751cc..cebf000e 100644 --- a/src/main/java/com/sparrowwallet/sparrow/whirlpool/dataSource/SparrowDataSource.java +++ b/src/main/java/com/sparrowwallet/sparrow/whirlpool/dataSource/SparrowDataSource.java @@ -8,6 +8,7 @@ import com.samourai.wallet.api.backend.seenBackend.SeenBackendWithFallback; import com.samourai.wallet.hd.HD_Wallet; import com.samourai.wallet.httpClient.HttpUsage; import com.samourai.wallet.httpClient.IHttpClient; +import com.samourai.wallet.util.ExtLibJConfig; import com.samourai.whirlpool.client.wallet.WhirlpoolWallet; import com.samourai.whirlpool.client.wallet.WhirlpoolWalletConfig; import com.samourai.whirlpool.client.wallet.data.coordinator.CoordinatorSupplier; @@ -57,7 +58,8 @@ public class SparrowDataSource extends AbstractDataSource { } private ISeenBackend computeSeenBackend(WhirlpoolWalletConfig whirlpoolWalletConfig) { - IHttpClient httpClient = whirlpoolWalletConfig.getHttpClient(HttpUsage.BACKEND); + ExtLibJConfig extLibJConfig = whirlpoolWalletConfig.getSorobanConfig().getExtLibJConfig(); + IHttpClient httpClient = extLibJConfig.getHttpClientService().getHttpClient(HttpUsage.BACKEND); ISeenBackend sparrowSeenBackend = new SparrowSeenBackend(getWhirlpoolWallet().getWalletIdentifier(), httpClient); NetworkParameters params = whirlpoolWalletConfig.getSamouraiNetwork().getParams(); return SeenBackendWithFallback.withOxt(sparrowSeenBackend, params);