- let mut state_vecs = HashMap::with_capacity(11);
- state_vecs.insert(AddressState::Untested, Vec::new());
- state_vecs.insert(AddressState::LowBlockCount, Vec::new());
- state_vecs.insert(AddressState::HighBlockCount, Vec::new());
- state_vecs.insert(AddressState::LowVersion, Vec::new());
- state_vecs.insert(AddressState::BadVersion, Vec::new());
- state_vecs.insert(AddressState::NotFullNode, Vec::new());
- state_vecs.insert(AddressState::ProtocolViolation, Vec::new());
- state_vecs.insert(AddressState::Timeout, Vec::new());
- state_vecs.insert(AddressState::TimeoutDuringRequest, Vec::new());
- state_vecs.insert(AddressState::Good, Vec::new());
- state_vecs.insert(AddressState::WasGood, Vec::new());
- let mut good_node_services = HashMap::with_capacity(64);
- for i in 0..64 {
- good_node_services.insert(i, HashSet::new());
+ let mut state_vecs = Vec::with_capacity(AddressState::get_count() as usize);
+ for _ in 0..AddressState::get_count() {
+ state_vecs.push(Vec::new());
+ }
+ let mut good_node_services = Vec::with_capacity(64);
+ for _ in 0..64 {
+ good_node_services.push(HashSet::new());