Adjust stemstream to not try to diffuse a block if there is no time left in epoch

This commit is contained in:
Kevin F 2023-01-23 17:55:25 -06:00
parent 70c7eca9c5
commit 7caaa829f2

View File

@ -30,11 +30,14 @@ async def do_stem_stream(
try: try:
# queues can't block because we're in async # queues can't block because we're in async
bl = block_queue.get(block=False) bl = block_queue.get(block=False)
assert hasattr(bl, 'raw')
except Empty: except Empty:
remaining_time = d_phase.remaining_time() remaining_time = d_phase.remaining_time()
await sleep(1) await sleep(1)
else: else:
break break
if not remaining_time:
break
logging.info("Sending block over dandelion++") logging.info("Sending block over dandelion++")
block_size = str(len(bl.raw)).zfill(BLOCK_SIZE_LEN) block_size = str(len(bl.raw)).zfill(BLOCK_SIZE_LEN)