From 23fd597ca55628d7f6f945b3fdfdbcde2d9a6481 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Thu, 14 Oct 2021 11:12:31 +0200 Subject: [PATCH] constrain mix from and mix to options to match those supported in the whirlpool client --- drongo | 2 +- .../java/com/sparrowwallet/sparrow/wallet/MixToController.java | 2 ++ .../com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drongo b/drongo index 61b2fd21..c04c2494 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit 61b2fd21e6f623850ad8b5df9f0cec4a0c0908cc +Subproject commit c04c24945000f8f3c702801cea1c9921cc60cbbd diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/MixToController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/MixToController.java index 6aebc2be..8e1e83ba 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/MixToController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/MixToController.java @@ -1,5 +1,6 @@ package com.sparrowwallet.sparrow.wallet; +import com.sparrowwallet.drongo.protocol.ScriptType; import com.sparrowwallet.drongo.wallet.MixConfig; import com.sparrowwallet.drongo.wallet.StandardAccount; import com.sparrowwallet.drongo.wallet.Wallet; @@ -44,6 +45,7 @@ public class MixToController implements Initializable { allWallets.add(NONE_WALLET); List destinationWallets = AppServices.get().getOpenWallets().keySet().stream().filter(openWallet -> openWallet.isValid() + && (openWallet.getScriptType() == ScriptType.P2WPKH || openWallet.getScriptType() == ScriptType.P2WSH || openWallet.getScriptType() == ScriptType.P2TR) && openWallet != wallet && openWallet != wallet.getMasterWallet() && (openWallet.getStandardAccountType() == null || !StandardAccount.WHIRLPOOL_ACCOUNTS.contains(openWallet.getStandardAccountType()))).collect(Collectors.toList()); allWallets.addAll(destinationWallets); diff --git a/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java b/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java index 42453524..b1e4c337 100644 --- a/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java +++ b/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java @@ -137,7 +137,7 @@ public class WhirlpoolServices { && wallet.getKeystores().get(0).hasSeed() && wallet.getKeystores().get(0).getSeed().getType() == DeterministicSeed.Type.BIP39 && wallet.getStandardAccountType() != null - && !wallet.isWhirlpoolMixWallet(); + && StandardAccount.MIXABLE_ACCOUNTS.contains(wallet.getStandardAccountType()); } public static void prepareWhirlpoolWallet(Wallet decryptedWallet, String walletId, Storage storage) {