mirror of https://github.com/poanetwork/hbbft.git
Merge pull request #305 from poanetwork/afck-fix-sbv-bc
Fix SbvBroadcast observer issue.
This commit is contained in:
commit
52d48675f0
|
@ -145,7 +145,7 @@ impl<N: NodeIdT> SbvBroadcast<N> {
|
|||
/// Multicasts and handles a message. Does nothing if we are only an observer.
|
||||
fn send(&mut self, msg: Message) -> Result<Step<N>> {
|
||||
if !self.netinfo.is_validator() {
|
||||
return Ok(Step::default());
|
||||
return self.try_output();
|
||||
}
|
||||
let step: Step<_> = Target::All.message(msg.clone()).into();
|
||||
let our_id = &self.our_id().clone();
|
||||
|
|
|
@ -94,6 +94,10 @@ impl<N: NodeIdT> ThresholdDecryption<N> {
|
|||
if self.ciphertext.is_some() {
|
||||
return Err(Error::MultipleInputs(Box::new(ct)));
|
||||
}
|
||||
if !self.netinfo.is_validator() {
|
||||
self.ciphertext = Some(ct);
|
||||
return Ok(self.try_output()?);
|
||||
}
|
||||
let share = match self.netinfo.secret_key_share().decrypt_share(&ct) {
|
||||
None => return Err(Error::InvalidCiphertext(Box::new(ct))),
|
||||
Some(share) => share,
|
||||
|
@ -102,11 +106,9 @@ impl<N: NodeIdT> ThresholdDecryption<N> {
|
|||
let our_id = self.our_id().clone();
|
||||
let mut step = Step::default();
|
||||
step.fault_log.extend(self.remove_invalid_shares());
|
||||
if self.netinfo.is_validator() {
|
||||
let msg = Target::All.message(Message(share.clone()));
|
||||
step.messages.push(msg);
|
||||
self.shares.insert(our_id, share);
|
||||
}
|
||||
let msg = Target::All.message(Message(share.clone()));
|
||||
step.messages.push(msg);
|
||||
self.shares.insert(our_id, share);
|
||||
step.extend(self.try_output()?);
|
||||
Ok(step)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue