From 0aea00ad2fe3b2dadbdf81bc17ebc3c4c539e2b7 Mon Sep 17 00:00:00 2001 From: RoMa Date: Mon, 25 Sep 2023 09:00:34 +0200 Subject: [PATCH] Smaller cache --- sockets/blocks.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sockets/blocks.py b/sockets/blocks.py index 68d66db..946b5c3 100644 --- a/sockets/blocks.py +++ b/sockets/blocks.py @@ -20,15 +20,16 @@ async def on_new_block(e): 'difficulty': block_info["verboseData"]["difficulty"], 'blueScore': block_info["header"]["blueScore"], 'timestamp': block_info["header"]["timestamp"], + 'txCount': len(block_info["transactions"]), 'txs': [{ 'txId': x["verboseData"]["transactionId"], 'outputs': [(output["verboseData"]["scriptPublicKeyAddress"], output["amount"]) for output in - x["outputs"]] - } for x in block_info["transactions"]] + x["outputs"][-20:]] + } for x in block_info["transactions"][-20:]] } BLOCKS_CACHE.append(emit_info) - if len(BLOCKS_CACHE) > 50: + if len(BLOCKS_CACHE) > 10: BLOCKS_CACHE.pop(0) await sio.emit("new-block", emit_info, room="blocks")