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 {
|
||||
OwnIdMissing
|
||||
UnknownSender
|
||||
}
|
||||
}
|
||||
|
@ -111,9 +110,6 @@ where
|
|||
where
|
||||
TI: IntoIterator<Item = T>,
|
||||
{
|
||||
if !netinfo.all_uids().contains(netinfo.our_uid()) {
|
||||
return Err(ErrorKind::OwnIdMissing.into());
|
||||
}
|
||||
let mut honey_badger = HoneyBadger {
|
||||
netinfo,
|
||||
buffer: txs.into_iter().collect(),
|
||||
|
|
|
@ -133,8 +133,11 @@ pub struct NetworkInfo<NodeUid> {
|
|||
num_faulty: usize,
|
||||
}
|
||||
|
||||
impl<NodeUid> NetworkInfo<NodeUid> {
|
||||
impl<NodeUid: Ord> NetworkInfo<NodeUid> {
|
||||
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();
|
||||
NetworkInfo {
|
||||
our_uid,
|
||||
|
|
Loading…
Reference in New Issue