commit d751cd169ff5aea7b33d8b5ee62445dcc9e53379
parent cab66a2fea98b07bcf9f30094c00d04047d740f3
Author: parazyd <parazyd@dyne.org>
Date: Thu, 15 Apr 2021 22:15:26 +0200
protocol: Add error guards for stuff that isn't implemented yet.
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/obelisk/protocol.py b/obelisk/protocol.py
@@ -242,6 +242,7 @@ class ElectrumProtocol(asyncio.Protocol): # pylint: disable=R0904,R0902
return {"result": safe_hexlify(header)}
# TODO: Help needed
+ return JsonRPCError.invalidrequest()
cp_headers = []
for i in range(index - 1, cp_height):
_ec, data = await self.bx.fetch_block_header(i)
@@ -294,9 +295,11 @@ class ElectrumProtocol(asyncio.Protocol): # pylint: disable=R0904,R0902
"count": len(headers) // 80,
"max": max_chunk_size,
}
+ return {"result": resp}
# The assumption is to fetch more headers if necessary.
# TODO: Review, help needed
+ return JsonRPCError.invalidrequest()
if cp_height > 0 and cp_height - start_height > count:
for i in range(cp_height - start_height):
_ec, data = await self.bx.fetch_block_header(start_height +
@@ -314,7 +317,6 @@ class ElectrumProtocol(asyncio.Protocol): # pylint: disable=R0904,R0902
resp["branch"] = [safe_hexlify(i) for i in branch]
resp["root"] = safe_hexlify(root)
- return {"result": resp}
async def blockchain_estimatefee(self, writer, query): # pylint: disable=W0613
"""Method: blockchain.estimatefee