beautified transactions print and fixed menu input

This commit is contained in:
Ryan Bakkes 2023-11-09 12:06:22 +01:00
parent 0219a8a7e9
commit e41127bd82

View File

@ -161,11 +161,15 @@ class MenuHelper:
case "Check the pool": case "Check the pool":
transactions = utilityHelper.loadFile("../data/transaction_pool.dat") transactions = utilityHelper.loadFile("../data/transaction_pool.dat")
if len(transactions) == 0:
print("Transaction pool is empty")
continue
x = 0 x = 0
for transaction in transactions: for transaction in transactions:
x += 1
print(f"---------------------------------------{x}-------------------------------------------") print(f"---------------------------------------{x}-------------------------------------------")
print(f"{transaction}") print(f"{transaction}")
x += 1 print("---------------------------------------END-------------------------------------------")
case "Mine a block": case "Mine a block":
taskHelper.createBlock(self) taskHelper.createBlock(self)
@ -211,7 +215,7 @@ class MenuHelper:
print("Wrong input, try again") print("Wrong input, try again")
return None return None
if choice > len(menu): if choice >= len(menu):
utilityHelper.clearScreen() utilityHelper.clearScreen()
print("Wrong input, try again") print("Wrong input, try again")
return None return None