tfix bugs on wallet creation - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 95df9cd1030c7fdb210171cdfcf170edfe4a59db DIR parent 46c0dda3b91889c5f8d25035c97bfdd217d41f29 HTML Author: ThomasV <thomasv@gitorious> Date: Thu, 1 May 2014 18:58:24 +0200 fix bugs on wallet creation Diffstat: M gui/qt/password_dialog.py | 2 +- M lib/wallet.py | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-) --- DIR diff --git a/gui/qt/password_dialog.py b/gui/qt/password_dialog.py t@@ -73,7 +73,7 @@ def make_password_dialog(self, wallet, msg): def run_password_dialog(self, wallet, parent): - if wallet.is_watching_only(): + if wallet and wallet.is_watching_only(): QMessageBox.information(parent, _('Error'), _('This is a watching-only wallet'), _('OK')) return False, None, None DIR diff --git a/lib/wallet.py b/lib/wallet.py t@@ -1150,6 +1150,22 @@ class Deterministic_Wallet(Abstract_Wallet): def check_password(self, password): self.get_seed(password) + def add_seed(self, seed, password): + if self.seed: + raise Exception("a seed exists") + + self.seed_version, self.seed = self.prepare_seed(seed) + if password: + self.seed = pw_encode( self.seed, password) + self.use_encryption = True + else: + self.use_encryption = False + + self.storage.put('seed', self.seed, True) + self.storage.put('seed_version', self.seed_version, True) + self.storage.put('use_encryption', self.use_encryption,True) + self.create_master_keys(password) + def get_seed(self, password): s = pw_decode(self.seed, password) seed = mnemonic_to_seed(s,'').encode('hex') t@@ -1389,22 +1405,6 @@ class NewWallet(Deterministic_Wallet): xpriv = pw_decode( k, password) return xpriv - def add_seed(self, seed, password): - if self.seed: - raise Exception("a seed exists") - - self.seed_version, self.seed = self.prepare_seed(seed) - if password: - self.seed = pw_encode( self.seed, password) - self.use_encryption = True - else: - self.use_encryption = False - - self.storage.put('seed', self.seed, True) - self.storage.put('seed_version', self.seed_version, True) - self.storage.put('use_encryption', self.use_encryption,True) - self.create_master_keys(password) - def create_watching_only_wallet(self, xpub): self.storage.put('seed_version', self.seed_version, True)