Skip to content

Commit

Permalink
Remove additional code for mempool.space support since their API chan…
Browse files Browse the repository at this point in the history
…ged and is now the same as Esplora
  • Loading branch information
ca-ruz committed Oct 19, 2024
1 parent efdc9bb commit ec3295c
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions sauron/sauron.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,6 @@ def init(plugin, options, **kwargs):
raise SauronError("You need to specify the sauron-api-endpoint option.")
sys.exit(1)

# Testing for Esplora or mempool.space API
try:
# MutinyNet API
feerate_url = "{}/v1/fees/recommended".format(plugin.api_endpoint)
feerate_req = fetch(feerate_url)
assert feerate_req.status_code == 200
plugin.is_mempoolspace = True
except AssertionError:
# Esplora API
plugin.is_mempoolspace = False

if options["sauron-tor-proxy"]:
address, port = options["sauron-tor-proxy"].split(":")
socks5_proxy = "socks5h://{}:{}".format(address, port)
Expand All @@ -66,7 +55,7 @@ def init(plugin, options, **kwargs):
}
plugin.log("Using proxy {} for requests".format(socks5_proxy))

api = "mempool.space" if plugin.is_mempoolspace else "Esplora"
api = "mempool.space" if "mutinynet.com" in plugin.api_endpoint else "Esplora"
plugin.log(f"Sauron plugin initialized using {api} API")
plugin.log(sauron_eye)

Expand Down Expand Up @@ -200,12 +189,7 @@ def getutxout(plugin, txid, vout, **kwargs):

@plugin.method("estimatefees")
def estimatefees(plugin, **kwargs):
if plugin.is_mempoolspace:
# MutinyNet API
feerate_url = "{}/v1/fees/recommended".format(plugin.api_endpoint)
else:
# Blockstream API
feerate_url = "{}/fee-estimates".format(plugin.api_endpoint)
feerate_url = "{}/fee-estimates".format(plugin.api_endpoint)

feerate_req = fetch(feerate_url)
assert feerate_req.status_code == 200
Expand Down

0 comments on commit ec3295c

Please sign in to comment.