Removes get_block_count endpoint

get_block_count was only for dummy testing and it's not used anymore
This commit is contained in:
Sergi Delgado Segura
2020-02-13 16:59:06 +01:00
parent 7e29824452
commit 3b5ff2e92c

View File

@@ -7,7 +7,6 @@ from pisa import HOST, PORT, LOG_PREFIX
from common.logger import Logger from common.logger import Logger
from pisa.inspector import Inspector from pisa.inspector import Inspector
from common.appointment import Appointment from common.appointment import Appointment
from pisa.block_processor import BlockProcessor
from common.constants import HTTP_OK, HTTP_BAD_REQUEST, HTTP_SERVICE_UNAVAILABLE, LOCATOR_LEN_HEX from common.constants import HTTP_OK, HTTP_BAD_REQUEST, HTTP_SERVICE_UNAVAILABLE, LOCATOR_LEN_HEX
@@ -83,7 +82,7 @@ class API:
else: else:
return jsonify({"error": error}), rcode return jsonify({"error": error}), rcode
# FIXME: THE NEXT THREE API ENDPOINTS ARE FOR TESTING AND SHOULD BE REMOVED / PROPERLY MANAGED BEFORE PRODUCTION! # FIXME: THE NEXT TWO API ENDPOINTS ARE FOR TESTING AND SHOULD BE REMOVED / PROPERLY MANAGED BEFORE PRODUCTION!
# ToDo: #17-add-api-keys # ToDo: #17-add-api-keys
def get_appointment(self): def get_appointment(self):
""" """
@@ -168,21 +167,6 @@ class API:
return response return response
@staticmethod
def get_block_count():
"""
Provides the block height of the Watchtower.
This is a testing endpoint that (most likely) will be removed in production. Its purpose is to give information
to testers about the current block so they can define a dummy appointment without having to run a bitcoin node.
Returns:
:obj:`dict`: A json encoded dictionary containing the block height.
"""
return jsonify({"block_count": BlockProcessor.get_block_count()})
def start(self): def start(self):
""" """
This function starts the Flask server used to run the API. Adds all the routes to the functions listed above. This function starts the Flask server used to run the API. Adds all the routes to the functions listed above.
@@ -192,7 +176,6 @@ class API:
"/": (self.add_appointment, ["POST"]), "/": (self.add_appointment, ["POST"]),
"/get_appointment": (self.get_appointment, ["GET"]), "/get_appointment": (self.get_appointment, ["GET"]),
"/get_all_appointments": (self.get_all_appointments, ["GET"]), "/get_all_appointments": (self.get_all_appointments, ["GET"]),
"/get_block_count": (self.get_block_count, ["GET"]),
} }
for url, params in routes.items(): for url, params in routes.items():