Timout python version (#3)

This commit is contained in:
Daniel Sanchez 2023-03-22 12:13:30 +01:00 committed by GitHub
parent dfbea2ce64
commit 26501440b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 27 deletions

View File

@ -91,7 +91,7 @@ class Vote:
```python ```python
class Timeout: class Timeout:
view: View view: View
high_qc: Qc high_qc: AggregateQc
``` ```
## Local Variables ## Local Variables
@ -305,37 +305,30 @@ def receive_vote(vote: Vote):
broadcast(block) broadcast(block)
``` ```
### Receive NewView ### Receive Timeout
```Ruby ```python
# Failure Case # Failure Case
Func receive(newView) { def receive(timeout: Timeout):
# download the missing block # download the missing block
if newview.highQC.block missing { if timeout.high_qc().block is missing:
let block = download(new_view.high_qc.block) block = download(timeout.high_qc.block)
receive(block) receive(block)
}
# It's an old message. Ignore it. # It's an old message. Ignore it.
if newView.view < current_view { if timeout.view < CURRENT_VIEW:
return return
}
update_high_qc(timeout.high_qc())
# Q: this was update_high_qc_and_view(new_view.high_qc, Null)
update_high_qc(new_view.high_qc) if member_of_internal_com():
COLLECTION[timeout.view].append(timeout)
if member_of_internal_com() { if supermajority(timeout.view):
collection[newView.view].append(newView) new_view_qc = build_qc(COLLECTION[timeout.view])
if supermajority[newView.view]{ if member_of_root():
newViewQC=buildQC(collection[newView.view]) send(new_view_qc, leader(CURRENT_VIEW +1))
if member_of_root(){ CURRENT_VIEW += 1
send(newViewQC, leader(view+1)) else:
curView++ send(new_view_qc, parent_committee())
} else {
send(newViewQC, parent_committee())
}
}
}
}
``` ```
### Timeout ### Timeout
```python ```python