-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
37 lines (26 loc) · 1.01 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from Node import Node
import sys
from threading import Thread
if __name__ == '__main__':
process_id = int(input("Enter Your Process ID: "))
node = Node(process_id)
Thread(target=node.start(), args=()).start()
while True:
line = sys.stdin.readline().rstrip("\n")
command = line.split(" ")
if command[0] == "transfer":
node.moneyTransfer(int(command[1]), int(command[2]), int(command[3]))
elif command[0] == "failLink":
node.failLink(int(command[1]), int(command[2]))
elif command[0] == "fixLink":
node.fixLink(int(command[1]), int(command[2]))
elif command[0] == "failProcess":
node.failProcess()
elif command[0] == "printBlockchain":
node.printBlockchain()
elif command[0] == "printBalance":
node.printBalance()
elif command[0] == "printQueue":
node.printQueue()
else:
print("Error Command")