twallet: encrypt storage by default - electrum - Electrum Bitcoin wallet
 (HTM) git clone https://git.parazyd.org/electrum
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
       ---
 (DIR) commit 9b28f6df7beab821422537f816cbacbe6035f706
 (DIR) parent 9834d6cd94788fe41bc2b8e87e7642bd918e030a
 (HTM) Author: SomberNight <somber.night@protonmail.com>
       Date:   Thu, 19 Dec 2019 14:22:47 +0100
       
       wallet: encrypt storage by default
       
       notably, now also in kivy
       
       Diffstat:
         M electrum/base_wizard.py             |       4 ++--
         M electrum/commands.py                |       2 +-
         M electrum/gui/kivy/uix/dialogs/inst… |       2 +-
         M electrum/gui/qt/main_window.py      |       2 +-
         M electrum/wallet.py                  |       2 +-
       
       5 files changed, 6 insertions(+), 6 deletions(-)
       ---
 (DIR) diff --git a/electrum/base_wizard.py b/electrum/base_wizard.py
       t@@ -34,7 +34,7 @@ from . import bitcoin
        from . import keystore
        from . import mnemonic
        from .bip32 import is_bip32_derivation, xpub_type, normalize_bip32_derivation, BIP32Node
       -from .keystore import bip44_derivation, purpose48_derivation, Hardware_KeyStore
       +from .keystore import bip44_derivation, purpose48_derivation, Hardware_KeyStore, KeyStore
        from .wallet import (Imported_Wallet, Standard_Wallet, Multisig_Wallet,
                             wallet_types, Wallet, Abstract_Wallet)
        from .storage import (WalletStorage, StorageEncryptionVersion,
       t@@ -85,7 +85,7 @@ class BaseWizard(Logger):
                self.pw_args = None  # type: Optional[WizardWalletPasswordSetting]
                self._stack = []  # type: List[WizardStackItem]
                self.plugin = None  # type: Optional[BasePlugin]
       -        self.keystores = []
       +        self.keystores = []  # type: List[KeyStore]
                self.is_kivy = config.get('gui') == 'kivy'
                self.seed_type = None
        
 (DIR) diff --git a/electrum/commands.py b/electrum/commands.py
       t@@ -252,7 +252,7 @@ class Commands:
                if wallet.storage.is_encrypted_with_hw_device() and new_password:
                    raise Exception("Can't change the password of a wallet encrypted with a hw device.")
                b = wallet.storage.is_encrypted()
       -        wallet.update_password(password, new_password, b)
       +        wallet.update_password(password, new_password, encrypt_storage=b)
                wallet.storage.write()
                return {'password':wallet.has_password()}
        
 (DIR) diff --git a/electrum/gui/kivy/uix/dialogs/installwizard.py b/electrum/gui/kivy/uix/dialogs/installwizard.py
       t@@ -1151,7 +1151,7 @@ class InstallWizard(BaseWizard, Widget):
                    return
                def on_success(old_pin, pin):
                    assert old_pin is None
       -            run_next(pin, False)
       +            run_next(pin, True)
                def on_failure():
                    self.show_error(_('PIN mismatch'))
                    self.run('request_password', run_next)
 (DIR) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py
       t@@ -2107,7 +2107,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
                if not ok:
                    return
                try:
       -            self.wallet.update_password(old_password, new_password, encrypt_file)
       +            self.wallet.update_password(old_password, new_password, encrypt_storage=encrypt_file)
                except InvalidPassword as e:
                    self.show_error(str(e))
                    return
 (DIR) diff --git a/electrum/wallet.py b/electrum/wallet.py
       t@@ -1708,7 +1708,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
                    self.keystore.check_password(password)
                self.storage.check_password(password)
        
       -    def update_password(self, old_pw, new_pw, encrypt_storage=False):
       +    def update_password(self, old_pw, new_pw, *, encrypt_storage: bool = True):
                if old_pw is None and self.has_password():
                    raise InvalidPassword()
                self.check_password(old_pw)