avoid showing usb signing dialog for watch only keystores in multisig wallets

This commit is contained in:
Craig Raw 2022-10-26 08:31:36 +02:00
parent 467b834955
commit 29cd321724

View file

@ -752,7 +752,8 @@ public class HeadersController extends TransactionFormController implements Init
private void initializeSignButton(Wallet signingWallet) { private void initializeSignButton(Wallet signingWallet) {
Optional<Keystore> softwareKeystore = signingWallet.getKeystores().stream().filter(keystore -> keystore.getSource().equals(KeystoreSource.SW_SEED)).findAny(); Optional<Keystore> softwareKeystore = signingWallet.getKeystores().stream().filter(keystore -> keystore.getSource().equals(KeystoreSource.SW_SEED)).findAny();
Optional<Keystore> usbKeystore = signingWallet.getKeystores().stream().filter(keystore -> keystore.getSource().equals(KeystoreSource.HW_USB) || keystore.getSource().equals(KeystoreSource.SW_WATCH)).findAny(); Optional<Keystore> usbKeystore = signingWallet.getKeystores().stream()
.filter(keystore -> keystore.getSource().equals(KeystoreSource.HW_USB) || (signingWallet.getKeystores().size() == 1 && keystore.getSource().equals(KeystoreSource.SW_WATCH))).findAny();
Optional<Keystore> bip47Keystore = signingWallet.getKeystores().stream().filter(keystore -> keystore.getSource().equals(KeystoreSource.SW_PAYMENT_CODE)).findAny(); Optional<Keystore> bip47Keystore = signingWallet.getKeystores().stream().filter(keystore -> keystore.getSource().equals(KeystoreSource.SW_PAYMENT_CODE)).findAny();
if(softwareKeystore.isEmpty() && usbKeystore.isEmpty() && bip47Keystore.isEmpty()) { if(softwareKeystore.isEmpty() && usbKeystore.isEmpty() && bip47Keystore.isEmpty()) {
signButton.setDisable(true); signButton.setDisable(true);
@ -989,7 +990,8 @@ public class HeadersController extends TransactionFormController implements Init
List<String> fingerprints = headersForm.getSigningWallet().getKeystores().stream().map(keystore -> keystore.getKeyDerivation().getMasterFingerprint()).collect(Collectors.toList()); List<String> fingerprints = headersForm.getSigningWallet().getKeystores().stream().map(keystore -> keystore.getKeyDerivation().getMasterFingerprint()).collect(Collectors.toList());
List<Device> signingDevices = AppServices.getDevices().stream().filter(device -> fingerprints.contains(device.getFingerprint())).collect(Collectors.toList()); List<Device> 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; return;
} }