mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-11-02 18:26:43 +00:00
disallow duplicate xpubs in multisig wallet keystores
This commit is contained in:
parent
ce90e29284
commit
8a6d2da5c9
1 changed files with 12 additions and 0 deletions
|
@ -1710,6 +1710,10 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
|
|||
throw new InvalidWalletException("Keystore " + keystore.getLabel() + " derivation of " + keystore.getKeyDerivation().getDerivationPath() + " in " + scriptType.getName() + " wallet matches another default script type.");
|
||||
}
|
||||
}
|
||||
|
||||
if(containsDuplicateExtendedKeys()) {
|
||||
throw new InvalidWalletException("Wallet keystores have duplicate extended public keys");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean derivationMatchesAnotherScriptType(String derivationPath) {
|
||||
|
@ -1732,6 +1736,14 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
|
|||
return !keystores.stream().map(Keystore::getLabel).allMatch(new HashSet<>()::add);
|
||||
}
|
||||
|
||||
public boolean containsDuplicateExtendedKeys() {
|
||||
if(keystores.size() <= 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !keystores.stream().map(Keystore::getExtendedPublicKey).allMatch(new HashSet<>()::add);
|
||||
}
|
||||
|
||||
public void makeLabelsUnique(Keystore newKeystore) {
|
||||
makeLabelsUnique(newKeystore, false);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue