upgrade whirlpool-client 1.0.6

This commit is contained in:
zeroleak
2024-04-10 09:52:41 +02:00
parent cc739a71e9
commit da30d4223a
5 changed files with 7 additions and 25 deletions
@@ -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();
}
@@ -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);
}
@@ -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();
}
@@ -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);