jotted down the algorand algo in monolithic format

parent d0179bd3
......@@ -54,6 +54,9 @@ class Node(SystemEntity):
payload.pop(0) # removed source header
payload.pop(0) #removed destination header
def startNodeLifeCycle(self):
pass
def simulate(self,time):
# self.logger.info("simulating .. ")
......@@ -84,7 +87,7 @@ class Node(SystemEntity):
# not task pending at this time
pass
pass
if __name__ == '__main__':
# node = Node('1')
......
......@@ -10,6 +10,44 @@ class OverlayNode(Node):
super(OverlayNode, self).processMessage(time,payload)
print("from overlay node : "+str(payload))
def startNodeLifeCycle(self):
'''THis is monolithic algorand algorithm for a NOde'''
while True:
#increment round number
'''
TODo check if node is selected as BLOCK_PROPOSER
if yes
then
select highest priority subuser and gossip the message
wait for lambda_proposer=3 sec and hear other block propositions
take decision based on received propositions and determine if himself is a highest priority or not
if yes
broacast the block proposal <format of block proposal>
everybody except highest priority block proposer waits for t_proposer+t_block time to here the proposed block
if received proposal
then
start BA* with this new block
validate sortition of proposed block
if yes
then
start reduction
else
vote for empty block
else
start BA* with empty block
'''
pass
pass
......
......@@ -124,6 +124,38 @@ def testclassLessGenerator():
print(task)
print(i)
class TestYieldSequence:
def __init__(self):
self.o = self.A()
def A(self):
print("started A")
yield 2
print("Finishing A")
def B(self):
print("Started B")
try:
next(self.o)
except StopIteration:
pass
print("Ending B")
def C(self):
print("started C")
try:
next(self.o)
except StopIteration:
pass
print("Ending C")
def testExecutionSequenceYield(self):
self.B()
self.C()
if __name__ == '__main__':
# testSortition()
# testVerifyVRF()
......@@ -131,3 +163,4 @@ if __name__ == '__main__':
# testclassLessGenerator()
# testGeneratorClass()
testSelfReferGen()
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