Commit 2b3e6ec8 authored by UNHALE NILESH ARUN's avatar UNHALE NILESH ARUN

successfully created 2 blocks

parent 1f9d4d83
0 19 0 29
0 24 0 13
0 27 1 5
1 2 1 28
1 20
1 19
2 6 2 6
3 22 2 23
3 12 2 18
4 16 3 20
4 7 3 19
4 25 3 10
5 28 3 4
5 15 4 21
4 9
4 24
5 26
5 25
5 11
6 11
6 17
6 8 6 8
6 26 7 22
7 28 7 28
7 23 8 25
8 13 8 22
8 18 8 18
9 22 9 18
9 24 9 24
10 21 9 28
10 25
10 16 10 16
11 19 12 15
11 23 12 14
12 22 12 21
12 17 13 22
13 29 14 27
14 25 14 17
14 15
14 26 14 26
15 18
15 29 15 29
16 20 15 20
17 24 16 17
18 23 17 20
18 21 19 20
18 22 19 24
23 27 21 26
25 28 22 23
23 29
25 27
27 29
...@@ -19,6 +19,7 @@ class OverlayNode(Node): ...@@ -19,6 +19,7 @@ class OverlayNode(Node):
self.blockchain = [genesisBlock] self.blockchain = [genesisBlock]
self.tentativeblockchain = []
self.currentRound = 1 # round is equivalent ot block height self.currentRound = 1 # round is equivalent ot block height
self.step = 0 self.step = 0
self.currentRoleCount = 20 self.currentRoleCount = 20
...@@ -196,7 +197,6 @@ class OverlayNode(Node): ...@@ -196,7 +197,6 @@ class OverlayNode(Node):
msgs = self.uniqueReceivedMessages.pop(Config.PRIORITY_MSG_type) msgs = self.uniqueReceivedMessages.pop(Config.PRIORITY_MSG_type)
msgs.sort(key=lambda priority_msg_other: priority_msg_other[4]) msgs.sort(key=lambda priority_msg_other: priority_msg_other[4])
# list(map(lambda x: x[4], msgs)) # list only priorities
self.logger.info("Priority proposals from other nodes (number of proposal, proposals) : {}".format((len(msgs),list(map(lambda x: x[4], msgs))))) self.logger.info("Priority proposals from other nodes (number of proposal, proposals) : {}".format((len(msgs),list(map(lambda x: x[4], msgs)))))
# self.logger.info("Priority proposals from other nodes (number of proposal, proposals) : {}".format((len(msgs),msgs))) # self.logger.info("Priority proposals from other nodes (number of proposal, proposals) : {}".format((len(msgs),msgs)))
for priority_msg_other in msgs : for priority_msg_other in msgs :
...@@ -693,16 +693,17 @@ class OverlayNode(Node): ...@@ -693,16 +693,17 @@ class OverlayNode(Node):
if hblockSTAR == CountVotes_FINAL['return_block_hash']: if hblockSTAR == CountVotes_FINAL['return_block_hash']:
FNALIZED_BLOCK_msg = ( FNALIZED_BLOCK_msg = (
Config.FINALIZED_BLOCK_msg_type,hblockSTAR ) Config.FINALIZED_BLOCK_msg_type,hblockSTAR )
self.logger.info("broadcsting FINALIZED BLOCK : {}".format(FNALIZED_BLOCK_msg)) self.logger.info("FINALIZED BLOCK in round :"+str(self.currentRound)+" : {}".format(FNALIZED_BLOCK_msg))
self.broadcast(self.network.time, FNALIZED_BLOCK_msg) self.blockchain.append(str((self.currentPreviousHash,hblockSTAR)))
else: else:
TENTATIVE_BLOCK_msg = (Config.TENTATIVE_BLOCK_msg_type, hblockSTAR) TENTATIVE_BLOCK_msg = (Config.TENTATIVE_BLOCK_msg_type, hblockSTAR)
self.logger.info("broadcsting FINALIZED BLOCK : {}".format(TENTATIVE_BLOCK_msg)) self.logger.info("TENTATIVE BLOCK in round :"+str(self.currentRound)+" : {}".format(TENTATIVE_BLOCK_msg))
self.broadcast(self.network.time, TENTATIVE_BLOCK_msg) self.tentativeblockchain.append(str((self.currentPreviousHash,hblockSTAR)))
self.logger.info("BLOCKCHAIN : {}".format(self.blockchain))
# self.logger.info(self.uniqueReceivedMessages) # self.logger.info(self.uniqueReceivedMessages)
yield "resume", 40000 yield "resume", 40
......
...@@ -12,7 +12,7 @@ class TimeSimulator(object): ...@@ -12,7 +12,7 @@ class TimeSimulator(object):
return "Time : "+ str(self._systemTime) return "Time : "+ str(self._systemTime)
def startTicking(self,callback): def startTicking(self,callback):
for i in range(10000): for i in range(100000):
self._systemTime = self._systemTime + 1 self._systemTime = self._systemTime + 1
logger.info(self) logger.info(self)
callback(str(self._systemTime)) callback(str(self._systemTime))
......
...@@ -7,5 +7,5 @@ rm -rf ASim.log ...@@ -7,5 +7,5 @@ rm -rf ASim.log
rm -rf console.log rm -rf console.log
python3 Starter.py > console.log #python3 Starter.py > console.log
#python3 Starter.py | tee console.log python3 Starter.py | tee console.log
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment