check txo.has_address before calling txo.get_address()
This commit is contained in:
parent
28ea43c89e
commit
8e5d47061f
2 changed files with 5 additions and 1 deletions
|
@ -398,7 +398,7 @@ class BaseDatabase(SQLiteMixin):
|
|||
for txi in tx.inputs:
|
||||
if txi.txo_ref.txo is not None:
|
||||
txo = txi.txo_ref.txo
|
||||
if txo.get_address(self.ledger) == address:
|
||||
if txo.has_address and txo.get_address(self.ledger) == address:
|
||||
conn.execute(*self._insert_sql("txi", {
|
||||
'txid': tx.id,
|
||||
'txoid': txo.id,
|
||||
|
|
|
@ -226,6 +226,10 @@ class BaseOutput(InputOutput):
|
|||
def pubkey_hash(self):
|
||||
return self.script.values['pubkey_hash']
|
||||
|
||||
@property
|
||||
def has_address(self):
|
||||
return 'pubkey_hash' in self.script.values
|
||||
|
||||
def get_address(self, ledger):
|
||||
return ledger.hash160_to_address(self.pubkey_hash)
|
||||
|
||||
|
|
Loading…
Reference in a new issue