mirror of
https://github.com/aljazceru/plugins.git
synced 2025-12-24 08:34:18 +01:00
sauron: use esplora to get raw blocks
This commit is contained in:
committed by
Christian Decker
parent
cdebe828ae
commit
970a965430
@@ -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(),
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user