diff --git a/electrum/address_synchronizer.py b/electrum/address_synchronizer.py index 9a8464c98..efbe3552c 100644 --- a/electrum/address_synchronizer.py +++ b/electrum/address_synchronizer.py @@ -244,12 +244,13 @@ class AddressSynchronizer(Logger, EventListener): def get_transaction(self, txid: str) -> Transaction: tx = self.db.get_transaction(txid) - # add verified tx info - tx.deserialize() - for txin in tx._inputs: - tx_height, tx_pos = self.get_txpos(txin.prevout.txid.hex()) - txin.block_height = tx_height - txin.block_txpos = tx_pos + if tx: + # add verified tx info + tx.deserialize() + for txin in tx._inputs: + tx_height, tx_pos = self.get_txpos(txin.prevout.txid.hex()) + txin.block_height = tx_height + txin.block_txpos = tx_pos return tx def add_transaction(self, tx: Transaction, *, allow_unrelated=False, is_new=True) -> bool: diff --git a/electrum/util.py b/electrum/util.py index ba3738e35..622538074 100644 --- a/electrum/util.py +++ b/electrum/util.py @@ -1289,7 +1289,7 @@ class TxMinedInfo(NamedTuple): class ShortID(bytes): def __repr__(self): - return f"" + return f"" def __str__(self): return format_short_id(self) @@ -1314,7 +1314,7 @@ class ShortID(bytes): return ShortID.from_components(*components) @classmethod - def normalize(cls, data: Union[None, str, bytes, 'ShortChannelID']) -> Optional['ShortChannelID']: + def normalize(cls, data: Union[None, str, bytes, 'ShortID']) -> Optional['ShortID']: if isinstance(data, ShortID) or data is None: return data if isinstance(data, str):