diff --git a/drongo b/drongo index 2b7b650f..73eed3e2 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit 2b7b650faeeeda7fc25ab0962a6132e6531ced4c +Subproject commit 73eed3e292d6e3f91402fe024aede18b5a50a509 diff --git a/src/main/java/com/sparrowwallet/sparrow/control/AddAccountDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/AddAccountDialog.java index 27559324..cd720980 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/AddAccountDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/AddAccountDialog.java @@ -17,6 +17,8 @@ import org.controlsfx.glyphfont.Glyph; import java.util.ArrayList; import java.util.List; +import static com.sparrowwallet.drongo.wallet.StandardAccount.*; + public class AddAccountDialog extends Dialog> { private final ComboBox standardAccountCombo; private boolean discoverAccounts = false; @@ -53,13 +55,15 @@ public class AddAccountDialog extends Dialog> { List availableAccounts = new ArrayList<>(); for(StandardAccount standardAccount : StandardAccount.values()) { - if(!existingIndexes.contains(standardAccount.getAccountNumber()) && !StandardAccount.WHIRLPOOL_ACCOUNTS.contains(standardAccount)) { + if(!existingIndexes.contains(standardAccount.getAccountNumber()) && !WHIRLPOOL_ACCOUNTS.contains(standardAccount)) { availableAccounts.add(standardAccount); } } if(WhirlpoolServices.canWalletMix(masterWallet) && !masterWallet.isWhirlpoolMasterWallet()) { - availableAccounts.add(StandardAccount.WHIRLPOOL_PREMIX); + availableAccounts.add(WHIRLPOOL_PREMIX); + } else if(WhirlpoolServices.canWatchPostmix(masterWallet) && !existingIndexes.contains(WHIRLPOOL_POSTMIX.getAccountNumber())) { + availableAccounts.add(WHIRLPOOL_POSTMIX); } final ButtonType discoverButtonType = new javafx.scene.control.ButtonType("Discover", ButtonBar.ButtonData.LEFT); @@ -82,10 +86,14 @@ public class AddAccountDialog extends Dialog> { return "None Available"; } - if(StandardAccount.WHIRLPOOL_ACCOUNTS.contains(account)) { + if(account == WHIRLPOOL_PREMIX) { return "Whirlpool Accounts"; } + if(account == WHIRLPOOL_POSTMIX) { + return "Whirlpool Postmix (No mixing)"; + } + return account.getName(); } diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java index 82ea5ee4..86b1bc82 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java @@ -427,7 +427,7 @@ public class SendController extends WalletFormController implements Initializabl addFeeRangeTrackHighlight(0); efficiencyToggle.setOnAction(event -> { - if(getWalletForm().getWallet().isWhirlpoolMixWallet() && !overrideOptimizationStrategy) { + if(StandardAccount.WHIRLPOOL_MIX_ACCOUNTS.contains(getWalletForm().getWallet().getStandardAccountType()) && !overrideOptimizationStrategy) { AppServices.showWarningDialog("Privacy may be lost!", "It is recommended to optimize for privacy when sending coinjoined outputs."); overrideOptimizationStrategy = true; } @@ -1071,7 +1071,7 @@ public class SendController extends WalletFormController implements Initializabl private OptimizationStrategy getPreferredOptimizationStrategy() { OptimizationStrategy optimizationStrategy = Config.get().getSendOptimizationStrategy(); - if(getWalletForm().getWallet().isWhirlpoolMixWallet() && !overrideOptimizationStrategy) { + if(StandardAccount.WHIRLPOOL_MIX_ACCOUNTS.contains(getWalletForm().getWallet().getStandardAccountType()) && !overrideOptimizationStrategy) { optimizationStrategy = OptimizationStrategy.PRIVACY; } diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java index b8173d6d..896b8868 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java @@ -655,7 +655,7 @@ public class SettingsController extends WalletFormController implements Initiali private void addAndSaveAccount(Wallet masterWallet, StandardAccount standardAccount, Key key) { List childWallets; - if(StandardAccount.WHIRLPOOL_ACCOUNTS.contains(standardAccount)) { + if(standardAccount == StandardAccount.WHIRLPOOL_PREMIX) { childWallets = WhirlpoolServices.prepareWhirlpoolWallet(masterWallet, getWalletForm().getWalletId(), getWalletForm().getStorage()); } else { Wallet childWallet = masterWallet.addChildWallet(standardAccount); diff --git a/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java b/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java index c9704a3e..9ddef872 100644 --- a/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java +++ b/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolServices.java @@ -170,6 +170,12 @@ public class WhirlpoolServices { && StandardAccount.MIXABLE_ACCOUNTS.contains(wallet.getStandardAccountType()); } + public static boolean canWatchPostmix(Wallet wallet) { + return Whirlpool.WHIRLPOOL_NETWORKS.contains(Network.get()) + && wallet.getScriptType() != ScriptType.P2TR //Taproot not yet supported + && wallet.getKeystores().size() == 1; + } + public static List prepareWhirlpoolWallet(Wallet decryptedWallet, String walletId, Storage storage) { Whirlpool whirlpool = AppServices.getWhirlpoolServices().getWhirlpool(walletId); whirlpool.setScode(decryptedWallet.getMasterMixConfig().getScode());