diff --git a/torba/torba/client/basedatabase.py b/torba/torba/client/basedatabase.py index 14d4fea9e..fadbc6f9b 100644 --- a/torba/torba/client/basedatabase.py +++ b/torba/torba/client/basedatabase.py @@ -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, diff --git a/torba/torba/client/basetransaction.py b/torba/torba/client/basetransaction.py index 7669f6dc3..e54d5e509 100644 --- a/torba/torba/client/basetransaction.py +++ b/torba/torba/client/basetransaction.py @@ -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)