From 970a965430389d975ea49beed3d0a50f68d563af Mon Sep 17 00:00:00 2001 From: darosior Date: Thu, 2 Apr 2020 16:32:31 +0200 Subject: [PATCH] sauron: use esplora to get raw blocks --- sauron/sauron.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sauron/sauron.py b/sauron/sauron.py index 17cf20c..66471f9 100755 --- a/sauron/sauron.py +++ b/sauron/sauron.py @@ -53,10 +53,8 @@ def getrawblock(plugin, height, **kwargs): blockhash_url = "{}/block-height/{}".format(plugin.api_endpoint, height) blockhash_req = requests.get(blockhash_url) - # FIXME: Esplora now serves raw blocks, integrate it when deployed ! - # https://github.com/Blockstream/esplora/issues/171 - block_url = "https://blockchain.info/block/{}?format=hex" - block_req = requests.get(block_url.format(blockhash_req.text)) + block_req = requests.get("{}/block/{}/raw".format(plugin.api_endpoint, + blockhash_req.text)) if blockhash_req.status_code != 200 or block_req.status_code != 200: return { "blockhash": None, @@ -65,7 +63,7 @@ def getrawblock(plugin, height, **kwargs): return { "blockhash": blockhash_req.text, - "block": block_req.text, + "block": block_req.content.hex(), }