From 29cd321724f0406d7c527019b6e7ecebe879f274 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Wed, 26 Oct 2022 08:31:36 +0200 Subject: [PATCH] avoid showing usb signing dialog for watch only keystores in multisig wallets --- .../sparrow/transaction/HeadersController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java b/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java index 21534400..17c6bbbc 100644 --- a/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java +++ b/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java @@ -752,7 +752,8 @@ public class HeadersController extends TransactionFormController implements Init private void initializeSignButton(Wallet signingWallet) { Optional softwareKeystore = signingWallet.getKeystores().stream().filter(keystore -> keystore.getSource().equals(KeystoreSource.SW_SEED)).findAny(); - Optional usbKeystore = signingWallet.getKeystores().stream().filter(keystore -> keystore.getSource().equals(KeystoreSource.HW_USB) || keystore.getSource().equals(KeystoreSource.SW_WATCH)).findAny(); + Optional usbKeystore = signingWallet.getKeystores().stream() + .filter(keystore -> keystore.getSource().equals(KeystoreSource.HW_USB) || (signingWallet.getKeystores().size() == 1 && keystore.getSource().equals(KeystoreSource.SW_WATCH))).findAny(); Optional bip47Keystore = signingWallet.getKeystores().stream().filter(keystore -> keystore.getSource().equals(KeystoreSource.SW_PAYMENT_CODE)).findAny(); if(softwareKeystore.isEmpty() && usbKeystore.isEmpty() && bip47Keystore.isEmpty()) { signButton.setDisable(true); @@ -989,7 +990,8 @@ public class HeadersController extends TransactionFormController implements Init List fingerprints = headersForm.getSigningWallet().getKeystores().stream().map(keystore -> keystore.getKeyDerivation().getMasterFingerprint()).collect(Collectors.toList()); List signingDevices = AppServices.getDevices().stream().filter(device -> fingerprints.contains(device.getFingerprint())).collect(Collectors.toList()); - if(signingDevices.isEmpty() && headersForm.getSigningWallet().getKeystores().stream().noneMatch(keystore -> keystore.getSource().equals(KeystoreSource.HW_USB) || keystore.getSource().equals(KeystoreSource.SW_WATCH))) { + if(signingDevices.isEmpty() && headersForm.getSigningWallet().getKeystores().stream() + .noneMatch(keystore -> keystore.getSource().equals(KeystoreSource.HW_USB) || (headersForm.getSigningWallet().getKeystores().size() == 1 && keystore.getSource().equals(KeystoreSource.SW_WATCH)))) { return; }