From 429b733140a06985c8d0df28d5a9ce444c94f116 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 27 Sep 2021 13:24:29 +0200 Subject: [PATCH] prevent setting separate passwords on child wallets --- .../sparrowwallet/sparrow/wallet/SettingsController.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java index 22b86398..6bc166f1 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java @@ -588,14 +588,15 @@ public class SettingsController extends WalletFormController implements Initiali key = new Key(encryptionFullKey.getPrivKeyBytes(), walletForm.getStorage().getKeyDeriver().getSalt(), EncryptionType.Deriver.ARGON2); + Wallet masterWallet = walletForm.getWallet().isMasterWallet() ? walletForm.getWallet() : walletForm.getWallet().getMasterWallet(); if(dlg.isChangePassword()) { if(dlg.isDeleteBackups()) { walletForm.deleteBackups(); } walletForm.getStorage().setEncryptionPubKey(null); - walletForm.getWallet().decrypt(key); - for(Wallet childWallet : walletForm.getWallet().getChildWallets()) { + masterWallet.decrypt(key); + for(Wallet childWallet : masterWallet.getChildWallets()) { childWallet.decrypt(key); } saveWallet(true, false); @@ -606,8 +607,8 @@ public class SettingsController extends WalletFormController implements Initiali walletForm.deleteBackups(); } - walletForm.getWallet().encrypt(key); - for(Wallet childWallet : walletForm.getWallet().getChildWallets()) { + masterWallet.encrypt(key); + for(Wallet childWallet : masterWallet.getChildWallets()) { childWallet.encrypt(key); } walletForm.getStorage().setEncryptionPubKey(encryptionPubKey);