electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 95df9cd1030c7fdb210171cdfcf170edfe4a59db
parent 46c0dda3b91889c5f8d25035c97bfdd217d41f29
Author: ThomasV <thomasv@gitorious>
Date:   Thu,  1 May 2014 18:58:24 +0200

fix bugs on wallet creation

Diffstat:
Mgui/qt/password_dialog.py | 2+-
Mlib/wallet.py | 32++++++++++++++++----------------
2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/gui/qt/password_dialog.py b/gui/qt/password_dialog.py @@ -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 diff --git a/lib/wallet.py b/lib/wallet.py @@ -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') @@ -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)