Fix mempool url

This commit is contained in:
Reckless_Satoshi 2024-01-10 15:27:37 +00:00
parent 5e58f0c8ce
commit fe7a806d9d
No known key found for this signature in database
GPG Key ID: 9C4585B561315571

View File

@ -94,17 +94,14 @@ def get_minning_fee(priority: str, preliminary_amount: int) -> int:
from api.lightning.node import LNNode from api.lightning.node import LNNode
session = get_session() session = get_session()
mempool_url = ( mempool_url = "https://mempool.space"
"http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion"
if USE_TOR
else "https://mempool.space"
)
api_path = "/api/v1/fees/recommended" api_path = "/api/v1/fees/recommended"
try: try:
response = session.get(mempool_url + api_path) response = session.get(mempool_url + api_path)
response.raise_for_status() # Raises stored HTTPError, if one occurred response.raise_for_status() # Raises stored HTTPError, if one occurred
data = response.json() data = response.json()
if priority == "suggested": if priority == "suggested":
value = data.get("fastestFee") value = data.get("fastestFee")
elif priority == "minimum": elif priority == "minimum":
@ -116,7 +113,8 @@ def get_minning_fee(priority: str, preliminary_amount: int) -> int:
priority, priority,
) )
except Exception: except Exception as e:
print(e)
# Fetch mining fee from LND/CLN instance # Fetch mining fee from LND/CLN instance
if priority == "suggested": if priority == "suggested":
target_conf = config("SUGGESTED_TARGET_CONF", cast=int, default=2) target_conf = config("SUGGESTED_TARGET_CONF", cast=int, default=2)
@ -190,7 +188,8 @@ def get_exchange_rates(currencies):
blockchain_rates.append( blockchain_rates.append(
float(blockchain_prices[currency]["last"]) float(blockchain_prices[currency]["last"])
) )
except Exception: except Exception as e:
print(e)
blockchain_rates.append(np.nan) blockchain_rates.append(np.nan)
api_rates.append(blockchain_rates) api_rates.append(blockchain_rates)