From e41127bd826289c1af7e009d55ecb57b675319b5 Mon Sep 17 00:00:00 2001 From: spekulaas Date: Thu, 9 Nov 2023 12:06:22 +0100 Subject: [PATCH] beautified transactions print and fixed menu input --- goodchain/src/helpers/MenuHelper.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/goodchain/src/helpers/MenuHelper.py b/goodchain/src/helpers/MenuHelper.py index 60b8ee8..43b5b1d 100644 --- a/goodchain/src/helpers/MenuHelper.py +++ b/goodchain/src/helpers/MenuHelper.py @@ -161,11 +161,15 @@ class MenuHelper: case "Check the pool": transactions = utilityHelper.loadFile("../data/transaction_pool.dat") + if len(transactions) == 0: + print("Transaction pool is empty") + continue x = 0 for transaction in transactions: + x += 1 print(f"---------------------------------------{x}-------------------------------------------") print(f"{transaction}") - x += 1 + print("---------------------------------------END-------------------------------------------") case "Mine a block": taskHelper.createBlock(self) @@ -211,7 +215,7 @@ class MenuHelper: print("Wrong input, try again") return None - if choice > len(menu): + if choice >= len(menu): utilityHelper.clearScreen() print("Wrong input, try again") return None