fixed bytes encoding on getdata endpoint
This commit is contained in:
parent
4fbfd89b12
commit
2ba42ba145
@ -64,6 +64,7 @@ def download_blocks_from_communicator(comm_inst):
|
|||||||
if not comm_inst.shutdown and peerUsed.strip() != '':
|
if not comm_inst.shutdown and peerUsed.strip() != '':
|
||||||
logger.info("Attempting to download %s from %s..." % (blockHash[:12], peerUsed))
|
logger.info("Attempting to download %s from %s..." % (blockHash[:12], peerUsed))
|
||||||
content = peeraction.peer_action(comm_inst, peerUsed, 'getdata/' + blockHash, max_resp_size=3000000) # block content from random peer (includes metadata)
|
content = peeraction.peer_action(comm_inst, peerUsed, 'getdata/' + blockHash, max_resp_size=3000000) # block content from random peer (includes metadata)
|
||||||
|
|
||||||
if content != False and len(content) > 0:
|
if content != False and len(content) > 0:
|
||||||
try:
|
try:
|
||||||
content = content.encode()
|
content = content.encode()
|
||||||
|
@ -47,7 +47,8 @@ def get_block_data(publicAPI, data):
|
|||||||
try:
|
try:
|
||||||
block = block.encode() # Encode in case data is binary
|
block = block.encode() # Encode in case data is binary
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
abort(404)
|
if len(block) == 0:
|
||||||
|
abort(404)
|
||||||
block = bytesconverter.str_to_bytes(block)
|
block = bytesconverter.str_to_bytes(block)
|
||||||
resp = block
|
resp = block
|
||||||
if len(resp) == 0:
|
if len(resp) == 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user