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
}
# Q: this was update_high_qc_and_view(new_view.high_qc, Null) update_high_qc(timeout.high_qc())
update_high_qc(new_view.high_qc)
if member_of_internal_com() { if member_of_internal_com():
collection[newView.view].append(newView) COLLECTION[timeout.view].append(timeout)
if supermajority[newView.view]{ if supermajority(timeout.view):
newViewQC=buildQC(collection[newView.view]) new_view_qc = build_qc(COLLECTION[timeout.view])
if member_of_root(){ if member_of_root():
send(newViewQC, leader(view+1)) send(new_view_qc, leader(CURRENT_VIEW +1))
curView++ CURRENT_VIEW += 1
} else { else:
send(newViewQC, parent_committee()) send(new_view_qc, parent_committee())
}
}
}
}
``` ```
### Timeout ### Timeout
```python ```python