permit mixing from badbank

This commit is contained in:
Craig Raw 2021-10-12 12:46:42 +02:00
parent 63ec856e87
commit 776fcb3044
4 changed files with 11 additions and 9 deletions

View file

@ -224,7 +224,7 @@ public class UtxosController extends WalletFormController implements Initializab
public void mixSelected(ActionEvent event) { public void mixSelected(ActionEvent event) {
List<UtxoEntry> selectedEntries = getSelectedUtxos(); List<UtxoEntry> selectedEntries = getSelectedUtxos();
WhirlpoolDialog whirlpoolDialog = new WhirlpoolDialog(getWalletForm().getWalletId(), getWalletForm().getWallet(), selectedEntries); WhirlpoolDialog whirlpoolDialog = new WhirlpoolDialog(getWalletForm().getMasterWalletId(), getWalletForm().getWallet(), selectedEntries);
Optional<Tx0Preview> optTx0Preview = whirlpoolDialog.showAndWait(); Optional<Tx0Preview> optTx0Preview = whirlpoolDialog.showAndWait();
optTx0Preview.ifPresent(tx0Preview -> previewPremix(tx0Preview, selectedEntries)); optTx0Preview.ifPresent(tx0Preview -> previewPremix(tx0Preview, selectedEntries));
} }

View file

@ -66,6 +66,10 @@ public class WalletForm {
return wallet.isMasterWallet() ? wallet : wallet.getMasterWallet(); return wallet.isMasterWallet() ? wallet : wallet.getMasterWallet();
} }
public String getMasterWalletId() {
return storage.getWalletId(getMasterWallet());
}
public Storage getStorage() { public Storage getStorage() {
return storage; return storage;
} }

View file

@ -52,10 +52,7 @@ import javafx.concurrent.Task;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Collection; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class Whirlpool { public class Whirlpool {
@ -71,9 +68,9 @@ public class Whirlpool {
private final TorClientService torClientService; private final TorClientService torClientService;
private final WhirlpoolWalletService whirlpoolWalletService; private final WhirlpoolWalletService whirlpoolWalletService;
private final WhirlpoolWalletConfig config; private final WhirlpoolWalletConfig config;
private Tx0ParamService tx0ParamService; private final Tx0ParamService tx0ParamService;
private ExpirablePoolSupplier poolSupplier; private final ExpirablePoolSupplier poolSupplier;
private Tx0Service tx0Service; private final Tx0Service tx0Service;
private HD_Wallet hdWallet; private HD_Wallet hdWallet;
private String walletId; private String walletId;
private String mixToWalletId; private String mixToWalletId;
@ -162,7 +159,7 @@ public class Whirlpool {
HD_WalletFactoryGeneric hdWalletFactory = HD_WalletFactoryGeneric.getInstance(); HD_WalletFactoryGeneric hdWalletFactory = HD_WalletFactoryGeneric.getInstance();
byte[] seed = hdWalletFactory.computeSeedFromWords(words); byte[] seed = hdWalletFactory.computeSeedFromWords(words);
this.walletId = walletId; this.walletId = walletId;
hdWallet = new HD_Wallet(purpose, words, config.getNetworkParameters(), seed, passphrase, 1); hdWallet = new HD_Wallet(purpose, words, config.getNetworkParameters(), seed, passphrase, 10);
} catch(Exception e) { } catch(Exception e) {
throw new IllegalStateException("Could not create Whirlpool HD wallet ", e); throw new IllegalStateException("Could not create Whirlpool HD wallet ", e);
} }

View file

@ -136,6 +136,7 @@ public class WhirlpoolServices {
&& wallet.getKeystores().size() == 1 && wallet.getKeystores().size() == 1
&& wallet.getKeystores().get(0).hasSeed() && wallet.getKeystores().get(0).hasSeed()
&& wallet.getKeystores().get(0).getSeed().getType() == DeterministicSeed.Type.BIP39 && wallet.getKeystores().get(0).getSeed().getType() == DeterministicSeed.Type.BIP39
&& wallet.getStandardAccountType() != null
&& !wallet.isWhirlpoolMixWallet(); && !wallet.isWhirlpoolMixWallet();
} }