mirror of https://github.com/poanetwork/hbbft.git
moved the own ID membership test to the NetworkInfo constructor
This commit is contained in:
parent
98f5304d4c
commit
ede1c7d157
|
@ -27,7 +27,6 @@ error_chain!{
|
||||||
}
|
}
|
||||||
|
|
||||||
errors {
|
errors {
|
||||||
OwnIdMissing
|
|
||||||
UnknownSender
|
UnknownSender
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,9 +110,6 @@ where
|
||||||
where
|
where
|
||||||
TI: IntoIterator<Item = T>,
|
TI: IntoIterator<Item = T>,
|
||||||
{
|
{
|
||||||
if !netinfo.all_uids().contains(netinfo.our_uid()) {
|
|
||||||
return Err(ErrorKind::OwnIdMissing.into());
|
|
||||||
}
|
|
||||||
let mut honey_badger = HoneyBadger {
|
let mut honey_badger = HoneyBadger {
|
||||||
netinfo,
|
netinfo,
|
||||||
buffer: txs.into_iter().collect(),
|
buffer: txs.into_iter().collect(),
|
||||||
|
|
|
@ -133,8 +133,11 @@ pub struct NetworkInfo<NodeUid> {
|
||||||
num_faulty: usize,
|
num_faulty: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<NodeUid> NetworkInfo<NodeUid> {
|
impl<NodeUid: Ord> NetworkInfo<NodeUid> {
|
||||||
pub fn new(our_uid: NodeUid, all_uids: BTreeSet<NodeUid>) -> Self {
|
pub fn new(our_uid: NodeUid, all_uids: BTreeSet<NodeUid>) -> Self {
|
||||||
|
if !all_uids.contains(&our_uid) {
|
||||||
|
panic!("Missing own ID");
|
||||||
|
}
|
||||||
let num_nodes = all_uids.len();
|
let num_nodes = all_uids.len();
|
||||||
NetworkInfo {
|
NetworkInfo {
|
||||||
our_uid,
|
our_uid,
|
||||||
|
|
Loading…
Reference in New Issue