def get_tx_parents(self, txid: str) -> Dict[str, Tuple[List[str], List[str]]]:
        """
        returns a flat dict:
        txid -> list of parent txids
        """
        with self.lock:
            if self._last_full_history is None:
                self._last_full_history = self.get_onchain_history()
                # populate cache in chronological order (confirmed tx only)
                # todo: get_full_history should return unconfirmed tx topologically sorted
                for _txid, tx_item in self._last_full_history.items():
                    if tx_item.tx_mined_status.height > 0:
                        self.get_tx_parents(_txid)

            result = self._tx_parents_cache.get(txid, None)
            if result is not None:
                return result
            result = {}   # type: Dict[str, Tuple[List[str], List[str]]]
            parents = []  # type: List[str]
            uncles = []   # type: List[str]
            tx = self.adb.get_transaction(txid)
            assert tx, f"cannot find {txid} in db"
            for i, txin in enumerate(tx.inputs()):
                _txid = txin.prevout.txid.hex()
                parents.append(_txid)
                # detect address reuse
                addr = self.adb.get_txin_address(txin)
                if addr is None:
                    continue
                received, sent = self.adb.get_addr_io(addr)
                if len(sent) > 1:
                    my_txid, my_height, my_pos = sent[txin.prevout.to_str()]
                    assert my_txid == txid
                    for k, v in sent.items():
                        if k != txin.prevout.to_str():
                            reuse_txid, reuse_height, reuse_pos = v
                            if reuse_height <= 0:  # exclude not-yet-mined (we need topological ordering)
                                continue
                            if (reuse_height, reuse_pos) < (my_height, my_pos):
                                uncle_txid, uncle_index = k.split(':')
                                uncles.append(uncle_txid)

            for _txid in parents + uncles:
                if _txid in self._last_full_history.keys():
                    result.update(self.get_tx_parents(_txid))
            result[txid] = parents, uncles
            self._tx_parents_cache[txid] = result
            return result

        returns a flat dict:
        txid -> list of parent txids
        
electrum/wallet.py