electrum

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

commit bab15a245bb2256222d9fb2b16035cf06aae3666
parent d950cd7323b2b430a8a0443737092bf2d48f9f0a
Author: ThomasV <thomasv@electrum.org>
Date:   Fri, 14 Oct 2016 12:09:43 +0200

simplification (get rid of get_mnemonic)

Diffstat:
Mgui/qt/main_window.py | 4++--
Mlib/commands.py | 2+-
Mlib/keystore.py | 15++++++---------
Mlib/wallet.py | 3---
4 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -1706,13 +1706,13 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): return keystore = self.wallet.get_keystore() try: - mnemonic = keystore.get_mnemonic(password) + seed = keystore.get_seed(password) passphrase = keystore.get_passphrase(password) except BaseException as e: self.show_error(str(e)) return from seed_dialog import SeedDialog - d = SeedDialog(self, mnemonic, passphrase) + d = SeedDialog(self, seed, passphrase) d.exec_() diff --git a/lib/commands.py b/lib/commands.py @@ -346,7 +346,7 @@ class Commands: @command('wp') def getseed(self): """Get seed phrase. Print the generation seed of your wallet.""" - s = self.wallet.get_mnemonic(self._password) + s = self.wallet.get_seed(self._password) return s.encode('utf8') @command('wp') diff --git a/lib/keystore.py b/lib/keystore.py @@ -318,9 +318,6 @@ class BIP32_KeyStore(Deterministic_KeyStore, Xpub): def is_watching_only(self): return self.xprv is None - def get_mnemonic(self, password): - return self.get_seed(password) - def add_xprv(self, xprv): self.xprv = xprv self.xpub = bitcoin.xpub_from_xprv(xprv) @@ -344,7 +341,7 @@ class Old_KeyStore(Deterministic_KeyStore): Deterministic_KeyStore.__init__(self, d) self.mpk = d.get('mpk') - def get_seed(self, password): + def get_hex_seed(self, password): return pw_decode(self.seed, password).encode('utf8') def dump(self): @@ -376,9 +373,9 @@ class Old_KeyStore(Deterministic_KeyStore): raise Exception("Invalid seed") return seed - def get_mnemonic(self, password): + def get_seed(self, password): import old_mnemonic - s = self.get_seed(password) + s = self.get_hex_seed(password) return ' '.join(old_mnemonic.mn_encode(s)) @classmethod @@ -423,7 +420,7 @@ class Old_KeyStore(Deterministic_KeyStore): return SecretToASecret(pk, compressed) def get_private_key(self, sequence, password): - seed = self.get_seed(password) + seed = self.get_hex_seed(password) self.check_seed(seed) for_change, n = sequence secexp = self.stretch_key(seed) @@ -439,7 +436,7 @@ class Old_KeyStore(Deterministic_KeyStore): raise InvalidPassword() def check_password(self, password): - seed = self.get_seed(password) + seed = self.get_hex_seed(password) self.check_seed(seed) def get_master_public_key(self): @@ -476,7 +473,7 @@ class Old_KeyStore(Deterministic_KeyStore): if new_password == '': new_password = None if self.has_seed(): - decoded = self.get_seed(old_password) + decoded = self.get_hex_seed(old_password) self.seed = pw_encode(decoded, new_password) diff --git a/lib/wallet.py b/lib/wallet.py @@ -1415,9 +1415,6 @@ class Deterministic_Wallet(Abstract_Wallet): def add_seed(self, seed, pw): self.keystore.add_seed(seed, pw) - def get_mnemonic(self, password): - return self.keystore.get_mnemonic(password) - def change_gap_limit(self, value): '''This method is not called in the code, it is kept for console use''' if value >= self.gap_limit: