From 3b0eb01c0cafb8e9f7ef83bfc5d02f44de948ff9 Mon Sep 17 00:00:00 2001 From: Andrey Date: Mon, 6 Mar 2023 19:28:08 +0200 Subject: [PATCH] Fix lint and conformation can set as 0. --- backend/moonstreamapi/middleware.py | 2 +- .../mooncrawl/moonworm_crawler/continuous_crawler.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/moonstreamapi/middleware.py b/backend/moonstreamapi/middleware.py index 9030e9c1..229831f4 100644 --- a/backend/moonstreamapi/middleware.py +++ b/backend/moonstreamapi/middleware.py @@ -24,7 +24,7 @@ class MoonstreamHTTPException(HTTPException): status_code: int, detail: Any = None, headers: Optional[Dict[str, Any]] = None, - internal_error: Exception = None, + internal_error: Optional[Exception] = None, ): super().__init__(status_code, detail, headers) if internal_error is not None: diff --git a/crawlers/mooncrawl/mooncrawl/moonworm_crawler/continuous_crawler.py b/crawlers/mooncrawl/mooncrawl/moonworm_crawler/continuous_crawler.py index cefd0435..9cff3405 100644 --- a/crawlers/mooncrawl/mooncrawl/moonworm_crawler/continuous_crawler.py +++ b/crawlers/mooncrawl/mooncrawl/moonworm_crawler/continuous_crawler.py @@ -103,7 +103,6 @@ def continuous_crawler( ), "min_blocks_batch must be less than max_blocks_batch" assert min_blocks_batch > 0, "min_blocks_batch must be greater than 0" assert max_blocks_batch > 0, "max_blocks_batch must be greater than 0" - assert confirmations > 0, "confirmations must be greater than 0" assert min_sleep_time > 0, "min_sleep_time must be greater than 0" assert heartbeat_interval > 0, "heartbeat_interval must be greater than 0" assert ( @@ -124,8 +123,8 @@ def continuous_crawler( network = Network.mumbai elif blockchain_type == AvailableBlockchainType.XDAI: network = Network.xdai - elif blockchain_type == AvailableBlockchainType.CALDERA: - network = Network.caldera + elif blockchain_type == AvailableBlockchainType.WYRM: + network = Network.wyrm else: raise ValueError(f"Unknown blockchain type: {blockchain_type}") @@ -167,6 +166,11 @@ def continuous_crawler( start_block + max_blocks_batch, ) + print(f"start_block: {start_block}, end_block: {end_block}") + print(f"web3.eth.blockNumber: {web3.eth.blockNumber}") + print(f"confirmations: {confirmations}") + print(f"max_blocks_batch: {max_blocks_batch}") + if start_block + min_blocks_batch > end_block: current_sleep_time += 0.1 logger.info(