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
76
77
78
79
80
81
82
83
crate::ix!();

pub trait StartScheduledTasks {

    /**
      | Begin running background tasks, should
      | only be called once
      |
      */
    fn start_scheduled_tasks(self: Arc<Self>, scheduler: Arc<Mutex<Scheduler>>);
}

pub trait IgnoresIncomingTxs {

    /**
      | Whether this node ignores txs received
      | over p2p.
      |
      */
    fn ignores_incoming_txs(&mut self) -> bool;
}

pub trait RelayTransaction {

    /**
      | Relay transaction to all peers.
      |
      */
    fn relay_transaction(
        self:  Arc<Self>,
        txid:  &u256,
        wtxid: &u256);

}

pub trait SendPings {

    /**
      | Send ping message to all peers
      |
      */
    fn send_pings(&mut self);
}

pub trait SetBestHeight {

    /**
      | Set the best height
      |
      */
    fn set_best_height(&mut self, height: i32);
}

pub trait Misbehaving {

    /**
      | Increment peer's misbehavior score.
      | If the new value >= DISCOURAGEMENT_THRESHOLD,
      | mark the node to be discouraged, meaning
      | the peer might be disconnected and added
      | to the discouragement filter.
      | 
      | Public for unit testing.
      |
      */
    fn misbehaving(&self, 
            pnode:   NodeId,
            howmuch: i32,
            message: &str);
}

pub trait CheckForStaleTipAndEvictPeers {

    /**
      | Evict extra outbound peers. If we think
      | our tip may be stale, connect to an extra
      | outbound.
      | 
      | Public for unit testing.
      |
      */
    fn check_for_stale_tip_and_evict_peers(self: Arc<Self>);
}