commit 1b3f428e884c5ffae6af33b8cdab1ced49b28590
parent bca6ad52410ca5ee8c5f4af3e589c0bcb24d8c5f
Author: SomberNight <somber.night@protonmail.com>
Date: Wed, 27 Mar 2019 16:30:21 +0100
keystore: speedup for Old_KeyStore
from Electron-Cash/Electron-Cash@01177d7deb1a56b423af6cf73a9b8ff5d64b24b3
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/electrum/keystore.py b/electrum/keystore.py
@@ -451,14 +451,15 @@ class Old_KeyStore(Deterministic_KeyStore):
def get_private_key(self, sequence, password):
seed = self.get_hex_seed(password)
- self.check_seed(seed)
- for_change, n = sequence
secexp = self.stretch_key(seed)
+ self.check_seed(seed, secexp=secexp)
+ for_change, n = sequence
pk = self.get_private_key_from_stretched_exponent(for_change, n, secexp)
return pk, False
- def check_seed(self, seed):
- secexp = self.stretch_key(seed)
+ def check_seed(self, seed, *, secexp=None):
+ if secexp is None:
+ secexp = self.stretch_key(seed)
master_private_key = ecc.ECPrivkey.from_secret_scalar(secexp)
master_public_key = master_private_key.get_public_key_bytes(compressed=False)[1:]
if master_public_key != bfh(self.mpk):