mirror of https://github.com/poanetwork/hbbft.git
Modify send_echo_remaining to take a hash parameter
This commit is contained in:
parent
2db02d00e3
commit
6d3bfc802f
|
@ -378,7 +378,7 @@ impl<N: NodeIdT> Broadcast<N> {
|
|||
// Upon receiving 2f + 1 matching Ready(h) messages, send full
|
||||
// `Echo` message to every node who hasn't sent us a `CanDecode`
|
||||
if self.count_readys(hash) == 2 * self.netinfo.num_faulty() + 1 {
|
||||
step.extend(self.send_echo_remaining()?);
|
||||
step.extend(self.send_echo_remaining(hash)?);
|
||||
}
|
||||
|
||||
Ok(step.join(self.compute_output(hash)?))
|
||||
|
@ -409,7 +409,7 @@ impl<N: NodeIdT> Broadcast<N> {
|
|||
}
|
||||
|
||||
/// Sends `Echo` message to remaining nodes who haven't sent `CanDecode`
|
||||
fn send_echo_remaining(&mut self) -> Result<Step<N>> {
|
||||
fn send_echo_remaining(&mut self, hash: &Digest) -> Result<Step<N>> {
|
||||
self.echo_sent = true;
|
||||
if !self.netinfo.is_validator() {
|
||||
return Ok(Step::default());
|
||||
|
@ -420,6 +420,13 @@ impl<N: NodeIdT> Broadcast<N> {
|
|||
return Ok(Step::default());
|
||||
}
|
||||
|
||||
// Can't send `Echo` if we haven't received a `Value` message for that hash from Proposer.
|
||||
if let Some((h, _)) = self.echos.get(self.our_id()) {
|
||||
if h != hash {
|
||||
return Ok(Step::default());
|
||||
}
|
||||
}
|
||||
|
||||
if let Some((_, None)) = self.echos.get(self.our_id()) {
|
||||
return Ok(Step::default());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue