ckb_network/behaviour.rs
1use crate::Score;
2
3/// Peers behaviours
4/// we maintain a score to each peer
5/// report peer behaviour will affects peer's score
6///
7/// Currently this feature is disabled, maybe someday we will add it back or totally remove it.
8#[derive(Debug, Clone, Copy, Eq, PartialEq)]
9pub enum Behaviour {
10 #[cfg(test)]
11 TestGood,
12 #[cfg(test)]
13 TestBad,
14}
15
16impl Behaviour {
17 /// Behaviour score
18 pub fn score(self) -> Score {
19 #[cfg(test)]
20 match self {
21 Behaviour::TestGood => 10,
22 Behaviour::TestBad => -10,
23 }
24 #[cfg(not(test))]
25 0
26 }
27}