mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
fix issue adding accounts to multisig wallets with mixed watch-only and seed keystores
This commit is contained in:
parent
258fe34101
commit
dcb261a631
1 changed files with 13 additions and 3 deletions
|
@ -471,7 +471,7 @@ public class SettingsController extends WalletFormController implements Initiali
|
|||
}
|
||||
|
||||
private void addAccounts(Wallet masterWallet, List<StandardAccount> standardAccounts, boolean discoverAccounts) {
|
||||
if(masterWallet.getKeystores().stream().allMatch(ks -> ks.getSource() == KeystoreSource.SW_SEED)) {
|
||||
if(masterWallet.getKeystores().stream().anyMatch(ks -> ks.getSource() == KeystoreSource.SW_SEED)) {
|
||||
if(masterWallet.isEncrypted()) {
|
||||
String walletId = walletForm.getWalletId();
|
||||
WalletPasswordDialog dlg = new WalletPasswordDialog(masterWallet.getName(), WalletPasswordDialog.PasswordRequirement.LOAD);
|
||||
|
@ -485,7 +485,12 @@ public class SettingsController extends WalletFormController implements Initiali
|
|||
encryptionFullKey.clear();
|
||||
masterWallet.decrypt(key);
|
||||
|
||||
if(discoverAccounts) {
|
||||
if(masterWallet.getKeystores().stream().anyMatch(ks -> ks.getSource() != KeystoreSource.SW_SEED)) {
|
||||
for(StandardAccount standardAccount : standardAccounts) {
|
||||
Wallet childWallet = masterWallet.addChildWallet(standardAccount);
|
||||
EventManager.get().post(new ChildWalletsAddedEvent(getWalletForm().getStorage(), masterWallet, childWallet));
|
||||
}
|
||||
} else if(discoverAccounts) {
|
||||
ElectrumServer.AccountDiscoveryService accountDiscoveryService = new ElectrumServer.AccountDiscoveryService(masterWallet, standardAccounts);
|
||||
accountDiscoveryService.setOnSucceeded(event -> {
|
||||
addAndEncryptAccounts(masterWallet, accountDiscoveryService.getValue(), key);
|
||||
|
@ -518,7 +523,12 @@ public class SettingsController extends WalletFormController implements Initiali
|
|||
keyDerivationService.start();
|
||||
}
|
||||
} else {
|
||||
if(discoverAccounts) {
|
||||
if(masterWallet.getKeystores().stream().anyMatch(ks -> ks.getSource() != KeystoreSource.SW_SEED)) {
|
||||
for(StandardAccount standardAccount : standardAccounts) {
|
||||
Wallet childWallet = masterWallet.addChildWallet(standardAccount);
|
||||
EventManager.get().post(new ChildWalletsAddedEvent(getWalletForm().getStorage(), masterWallet, childWallet));
|
||||
}
|
||||
} else if(discoverAccounts) {
|
||||
ElectrumServer.AccountDiscoveryService accountDiscoveryService = new ElectrumServer.AccountDiscoveryService(masterWallet, standardAccounts);
|
||||
accountDiscoveryService.setOnSucceeded(event -> {
|
||||
addAndSaveAccounts(masterWallet, accountDiscoveryService.getValue());
|
||||
|
|
Loading…
Reference in a new issue