mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-29 16:31:29 +00:00
keystore: another method needs to be moved
This commit is contained in:
parent
1d1da0e1dc
commit
8e181e0dec
1 changed files with 21 additions and 21 deletions
|
@ -70,6 +70,27 @@ class Software_KeyStore(KeyStore):
|
||||||
decrypted = ec.decrypt_message(message)
|
decrypted = ec.decrypt_message(message)
|
||||||
return decrypted
|
return decrypted
|
||||||
|
|
||||||
|
def get_keypairs_for_sig(self, tx, password):
|
||||||
|
keypairs = {}
|
||||||
|
for txin in tx.inputs():
|
||||||
|
num_sig = txin.get('num_sig')
|
||||||
|
if num_sig is None:
|
||||||
|
continue
|
||||||
|
x_signatures = txin['signatures']
|
||||||
|
signatures = filter(None, x_signatures)
|
||||||
|
if len(signatures) == num_sig:
|
||||||
|
# input is complete
|
||||||
|
continue
|
||||||
|
for k, x_pubkey in enumerate(txin['x_pubkeys']):
|
||||||
|
if x_signatures[k] is not None:
|
||||||
|
# this pubkey already signed
|
||||||
|
continue
|
||||||
|
derivation = txin['derivation']
|
||||||
|
sec = self.get_private_key(derivation, password)
|
||||||
|
if sec:
|
||||||
|
keypairs[x_pubkey] = sec
|
||||||
|
return keypairs
|
||||||
|
|
||||||
def sign_transaction(self, tx, password):
|
def sign_transaction(self, tx, password):
|
||||||
# Raise if password is not correct.
|
# Raise if password is not correct.
|
||||||
self.check_password(password)
|
self.check_password(password)
|
||||||
|
@ -277,27 +298,6 @@ class BIP32_KeyStore(Deterministic_KeyStore, Xpub):
|
||||||
def is_watching_only(self):
|
def is_watching_only(self):
|
||||||
return self.xprv is None
|
return self.xprv is None
|
||||||
|
|
||||||
def get_keypairs_for_sig(self, tx, password):
|
|
||||||
keypairs = {}
|
|
||||||
for txin in tx.inputs():
|
|
||||||
num_sig = txin.get('num_sig')
|
|
||||||
if num_sig is None:
|
|
||||||
continue
|
|
||||||
x_signatures = txin['signatures']
|
|
||||||
signatures = filter(None, x_signatures)
|
|
||||||
if len(signatures) == num_sig:
|
|
||||||
# input is complete
|
|
||||||
continue
|
|
||||||
for k, x_pubkey in enumerate(txin['x_pubkeys']):
|
|
||||||
if x_signatures[k] is not None:
|
|
||||||
# this pubkey already signed
|
|
||||||
continue
|
|
||||||
derivation = txin['derivation']
|
|
||||||
sec = self.get_private_key(derivation, password)
|
|
||||||
if sec:
|
|
||||||
keypairs[x_pubkey] = sec
|
|
||||||
|
|
||||||
return keypairs
|
|
||||||
|
|
||||||
def get_mnemonic(self, password):
|
def get_mnemonic(self, password):
|
||||||
return self.get_seed(password)
|
return self.get_seed(password)
|
||||||
|
|
Loading…
Add table
Reference in a new issue