mirror of https://github.com/poanetwork/hbbft.git
Rename is_full_node to is_peer.
This commit is contained in:
parent
2a5f9f1bfe
commit
2db67df325
|
@ -307,7 +307,7 @@ impl<NodeUid: Clone + Debug + Ord> Agreement<NodeUid> {
|
|||
}
|
||||
|
||||
fn send_bval(&mut self, b: bool) -> AgreementResult<()> {
|
||||
if !self.netinfo.is_full_node() {
|
||||
if !self.netinfo.is_peer() {
|
||||
return Ok(());
|
||||
}
|
||||
// Record the value `b` as sent.
|
||||
|
@ -329,7 +329,7 @@ impl<NodeUid: Clone + Debug + Ord> Agreement<NodeUid> {
|
|||
// Trigger the start of the `Conf` round.
|
||||
self.conf_round = true;
|
||||
|
||||
if !self.netinfo.is_full_node() {
|
||||
if !self.netinfo.is_peer() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
|
|
@ -293,7 +293,7 @@ impl<NodeUid: Debug + Clone + Ord> Broadcast<NodeUid> {
|
|||
|
||||
// Otherwise multicast the proof in an `Echo` message, and handle it ourselves.
|
||||
self.echo_sent = true;
|
||||
if self.netinfo.is_full_node() {
|
||||
if self.netinfo.is_peer() {
|
||||
let our_uid = &self.netinfo.our_uid().clone();
|
||||
self.handle_echo(our_uid, p.clone())?;
|
||||
let echo_msg = Target::All.message(BroadcastMessage::Echo(p));
|
||||
|
@ -330,7 +330,7 @@ impl<NodeUid: Debug + Clone + Ord> Broadcast<NodeUid> {
|
|||
|
||||
// Upon receiving `N - f` `Echo`s with this root hash, multicast `Ready`.
|
||||
self.ready_sent = true;
|
||||
if self.netinfo.is_full_node() {
|
||||
if self.netinfo.is_peer() {
|
||||
let ready_msg = Target::All.message(BroadcastMessage::Ready(hash.clone()));
|
||||
self.messages.push_back(ready_msg);
|
||||
let our_uid = &self.netinfo.our_uid().clone();
|
||||
|
@ -358,7 +358,7 @@ impl<NodeUid: Debug + Clone + Ord> Broadcast<NodeUid> {
|
|||
if self.count_readys(hash) == self.netinfo.num_faulty() + 1 && !self.ready_sent {
|
||||
// Enqueue a broadcast of a Ready message.
|
||||
self.ready_sent = true;
|
||||
if self.netinfo.is_full_node() {
|
||||
if self.netinfo.is_peer() {
|
||||
let ready_msg = Target::All.message(BroadcastMessage::Ready(hash.to_vec()));
|
||||
self.messages.push_back(ready_msg);
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ where
|
|||
}
|
||||
|
||||
fn get_coin(&mut self) -> Result<()> {
|
||||
if !self.netinfo.is_full_node() {
|
||||
if !self.netinfo.is_peer() {
|
||||
return self.try_output();
|
||||
}
|
||||
let share = self.netinfo.secret_key().sign(&self.nonce);
|
||||
|
|
|
@ -180,7 +180,7 @@ impl<NodeUid: Clone + Debug + Ord> CommonSubset<NodeUid> {
|
|||
/// Common Subset input message handler. It receives a value for broadcast
|
||||
/// and redirects it to the corresponding broadcast instance.
|
||||
pub fn send_proposed_value(&mut self, value: ProposedValue) -> CommonSubsetResult<()> {
|
||||
if !self.netinfo.is_full_node() {
|
||||
if !self.netinfo.is_peer() {
|
||||
return Ok(());
|
||||
}
|
||||
let uid = self.netinfo.our_uid().clone();
|
||||
|
|
|
@ -152,7 +152,7 @@ where
|
|||
&mut self,
|
||||
txs: I,
|
||||
) -> HoneyBadgerResult<()> {
|
||||
if self.netinfo.is_full_node() {
|
||||
if self.netinfo.is_peer() {
|
||||
self.buffer.extend(txs);
|
||||
Ok(())
|
||||
} else {
|
||||
|
@ -167,7 +167,7 @@ where
|
|||
|
||||
/// Proposes a new batch in the current epoch.
|
||||
fn propose(&mut self) -> HoneyBadgerResult<()> {
|
||||
if !self.netinfo.is_full_node() {
|
||||
if !self.netinfo.is_peer() {
|
||||
return Ok(());
|
||||
}
|
||||
let proposal = self.choose_transactions()?;
|
||||
|
@ -428,7 +428,7 @@ where
|
|||
self.verify_pending_decryption_shares(&proposer_id, &ciphertext);
|
||||
self.remove_incorrect_decryption_shares(&proposer_id, incorrect_senders);
|
||||
|
||||
if self.netinfo.is_full_node() {
|
||||
if self.netinfo.is_peer() {
|
||||
if let Some(share) = self.netinfo.secret_key().decrypt_share(&ciphertext) {
|
||||
// Send the share to remote nodes.
|
||||
self.messages.0.push_back(
|
||||
|
|
|
@ -218,7 +218,7 @@ impl<NodeUid: Clone + Ord> NetworkInfo<NodeUid> {
|
|||
|
||||
/// Returns `true` if this node takes part in the consensus itself. If not, it is only an
|
||||
/// observer.
|
||||
pub fn is_full_node(&self) -> bool {
|
||||
pub fn is_peer(&self) -> bool {
|
||||
self.all_uids.contains(&self.our_uid)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue