mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
fix saving encrypted keystores on all wallets when changing password on child wallets
This commit is contained in:
parent
9022438397
commit
930e36fa2b
1 changed files with 9 additions and 6 deletions
|
|
@ -26,6 +26,7 @@ public class SettingsWalletForm extends WalletForm {
|
||||||
public SettingsWalletForm(Storage storage, Wallet currentWallet) {
|
public SettingsWalletForm(Storage storage, Wallet currentWallet) {
|
||||||
super(storage, currentWallet, false);
|
super(storage, currentWallet, false);
|
||||||
this.walletCopy = currentWallet.copy();
|
this.walletCopy = currentWallet.copy();
|
||||||
|
this.walletCopy.setMasterWallet(walletCopy.isMasterWallet() ? null : walletCopy.getMasterWallet().copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -41,6 +42,7 @@ public class SettingsWalletForm extends WalletForm {
|
||||||
@Override
|
@Override
|
||||||
public void revert() {
|
public void revert() {
|
||||||
this.walletCopy = super.getWallet().copy();
|
this.walletCopy = super.getWallet().copy();
|
||||||
|
this.walletCopy.setMasterWallet(walletCopy.isMasterWallet() ? null : walletCopy.getMasterWallet().copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -82,18 +84,19 @@ public class SettingsWalletForm extends WalletForm {
|
||||||
EventManager.get().post(new WalletWatchLastChangedEvent(wallet, pastWallet, getWalletId(), walletCopy.getWatchLast()));
|
EventManager.get().post(new WalletWatchLastChangedEvent(wallet, pastWallet, getWalletId(), walletCopy.getWatchLast()));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Keystore> encryptionChangedKeystores = getEncryptionChangedKeystores(wallet, walletCopy);
|
Wallet masterWallet = getMasterWallet();
|
||||||
|
Wallet masterWalletCopy = walletCopy.isMasterWallet() ? walletCopy : walletCopy.getMasterWallet();
|
||||||
|
List<Keystore> encryptionChangedKeystores = getEncryptionChangedKeystores(masterWallet, masterWalletCopy);
|
||||||
if(!encryptionChangedKeystores.isEmpty()) {
|
if(!encryptionChangedKeystores.isEmpty()) {
|
||||||
EventManager.get().post(new KeystoreEncryptionChangedEvent(wallet, pastWallet, getWalletId(), encryptionChangedKeystores));
|
EventManager.get().post(new KeystoreEncryptionChangedEvent(masterWallet, masterWallet.copy(), getStorage().getWalletId(masterWallet), encryptionChangedKeystores));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Wallet childWallet : wallet.getChildWallets()) {
|
for(Wallet childWallet : masterWallet.getChildWallets()) {
|
||||||
Wallet childWalletCopy = walletCopy.getChildWallet(childWallet.getName());
|
Wallet childWalletCopy = masterWalletCopy.getChildWallet(childWallet.getName());
|
||||||
if(childWalletCopy != null) {
|
if(childWalletCopy != null) {
|
||||||
Wallet pastChildWallet = childWallet.copy();
|
|
||||||
List<Keystore> childEncryptionChangedKeystores = getEncryptionChangedKeystores(childWallet, childWalletCopy);
|
List<Keystore> childEncryptionChangedKeystores = getEncryptionChangedKeystores(childWallet, childWalletCopy);
|
||||||
if(!childEncryptionChangedKeystores.isEmpty()) {
|
if(!childEncryptionChangedKeystores.isEmpty()) {
|
||||||
EventManager.get().post(new KeystoreEncryptionChangedEvent(childWallet, pastChildWallet, getStorage().getWalletId(childWallet), childEncryptionChangedKeystores));
|
EventManager.get().post(new KeystoreEncryptionChangedEvent(childWallet, childWallet.copy(), getStorage().getWalletId(childWallet), childEncryptionChangedKeystores));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue