disallow duplicate xpubs in multisig wallet keystores

This commit is contained in:
Craig Raw 2022-07-25 14:47:08 +02:00
parent 08934d3c3c
commit 04917c45b6
2 changed files with 4 additions and 2 deletions

2
drongo

@ -1 +1 @@
Subproject commit b2f5f5ffebfc0ce9f0d992f3ac3b59965661491b
Subproject commit 8a6d2da5c911b3f63426c9e5331c55a36c27befc

View file

@ -238,7 +238,9 @@ public class KeystoreController extends WalletFormController implements Initiali
validationSupport.registerValidator(xpub, Validator.combine(
Validator.createEmptyValidator(Network.get().getXpubHeader().getDisplayName() + " is required"),
(Control c, String newValue) -> ValidationResult.fromErrorIf( c, Network.get().getXpubHeader().getDisplayName() + " is invalid", !ExtendedKey.isValid(newValue))
(Control c, String newValue) -> ValidationResult.fromErrorIf( c, Network.get().getXpubHeader().getDisplayName() + " is invalid", !ExtendedKey.isValid(newValue)),
(Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Extended key is not unique", ExtendedKey.isValid(newValue) &&
walletForm.getWallet().getKeystores().stream().filter(k -> k != keystore && k.getExtendedPublicKey() != null).map(Keystore::getExtendedPublicKey).collect(Collectors.toList()).contains(ExtendedKey.fromDescriptor(newValue)))
));
validationSupport.registerValidator(derivation, Validator.combine(