1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
crate::ix!();

/**
  | Per-txhash statistics object. Only
  | used for sanity checking.
  |
  */
pub struct TxHashInfo
{
    /**
      | Number of CANDIDATE_DELAYED announcements
      | for this txhash.
      |
      */
    pub candidate_delayed:             usize,

    /**
      | Number of CANDIDATE_READY announcements
      | for this txhash.
      |
      */
    pub candidate_ready:               usize,

    /**
      | Number of CANDIDATE_BEST announcements
      | for this txhash (at most one).
      |
      */
    pub candidate_best:                usize,

    /**
      | Number of REQUESTED announcements
      | for this txhash (at most one; mutually
      | exclusive with CANDIDATE_BEST).
      |
      */
    pub requested:                     usize,

    /**
      | The priority of the CANDIDATE_BEST
      | announcement if one exists, or max()
      | otherwise.
      |
      */
    pub priority_candidate_best:       Priority,

    /**
      | The highest priority of all CANDIDATE_READY
      | announcements (or min() if none exist).
      |
      */
    pub priority_best_candidate_ready: Priority,

    /**
      | All peers we have an announcement for
      | this txhash for.
      |
      */
    pub peers:                         Vec<NodeId>,
}

impl Default for TxHashInfo {

    fn default() -> Self {
        Self {
            candidate_delayed:             0,
            candidate_ready:               0,
            candidate_best:                0,
            requested:                     0,
            priority_candidate_best:       Priority::MAX,
            priority_best_candidate_ready: Priority::MIN,
            peers:                         vec![],
        }
    }
}