def METHOD_NAME(tx: BaseTransaction) -> int:
    """Return the height of the block that requested (directly or indirectly) the download of this transaction.
    If this value cannot be determined (either for the lack of a metadata or otherwise), the INF_HEIGHT constant is
    returned instead. So there will always be a value (it's never None).
    This is used to help prioritize which transaction to start from next on sync-v2 when syncing the transactions
    after downloading a chain of blocks.
    """
    assert tx.storage is not None
    if tx.is_block:
        assert isinstance(tx, Block)
        return tx.get_height()
    first_block = tx.get_metadata().first_block
    if first_block is None:
        # XXX: consensus did not run yet to update first_block, what should we do?
        #      I'm defaulting the height to `inf` (practically), this should make it heightest priority when
        #      choosing which transactions to fetch next
        return INF_HEIGHT
    block = tx.storage.get_transaction(first_block)
    assert isinstance(block, Block)
    return block.get_height()