mypy fixes

This commit is contained in:
Lex Berezhny 2019-09-17 01:57:47 -04:00
parent 81f16d7061
commit b7c2054a66
2 changed files with 3 additions and 0 deletions

View file

@ -191,12 +191,14 @@ class BaseLedger(metaclass=LedgerRegistry):
if match:
account, address_info = match
return account.get_private_key(address_info['chain'], address_info['position'])
return None
async def get_public_key_for_address(self, address) -> Optional[PubKey]:
match = await self._get_account_and_address_info_for_address(address)
if match:
account, address_info = match
return account.get_public_key(address_info['chain'], address_info['position'])
return None
async def get_account_for_address(self, address):
match = await self._get_account_and_address_info_for_address(address)

View file

@ -532,6 +532,7 @@ class BaseTransaction:
if txo_script.is_pay_pubkey_hash:
address = ledger.hash160_to_address(txo_script.values['pubkey_hash'])
private_key = await ledger.get_private_key_for_address(address)
assert private_key is not None
tx = self._serialize_for_signature(i)
txi.script.values['signature'] = \
private_key.sign(tx) + bytes((self.signature_hash_type(1),))