mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 09:21:39 +00:00
keystore: speedup for Old_KeyStore
from Electron-Cash/Electron-Cash@01177d7deb
This commit is contained in:
parent
bca6ad5241
commit
1b3f428e88
1 changed files with 5 additions and 4 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Reference in a new issue