Bitcoin Core  27.99.0
P2P Digital Currency
eviction.h
Go to the documentation of this file.
1 // Copyright (c) 2022 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_NODE_EVICTION_H
6 #define BITCOIN_NODE_EVICTION_H
7 
9 #include <net_permissions.h>
10 
11 #include <chrono>
12 #include <cstdint>
13 #include <optional>
14 #include <vector>
15 
16 typedef int64_t NodeId;
17 
20  std::chrono::seconds m_connected;
21  std::chrono::microseconds m_min_ping_time;
22  std::chrono::seconds m_last_block_time;
23  std::chrono::seconds m_last_tx_time;
27  uint64_t nKeyedNetGroup;
29  bool m_is_local;
31  bool m_noban;
33 };
34 
42 [[nodiscard]] std::optional<NodeId> SelectNodeToEvict(std::vector<NodeEvictionCandidate>&& vEvictionCandidates);
43 
67 void ProtectEvictionCandidatesByRatio(std::vector<NodeEvictionCandidate>& vEvictionCandidates);
68 
69 #endif // BITCOIN_NODE_EVICTION_H
ConnectionType
Different types of connections to a peer.
int64_t NodeId
Definition: eviction.h:16
std::optional< NodeId > SelectNodeToEvict(std::vector< NodeEvictionCandidate > &&vEvictionCandidates)
Select an inbound peer to evict after filtering out (protecting) peers having distinct,...
Definition: eviction.cpp:178
void ProtectEvictionCandidatesByRatio(std::vector< NodeEvictionCandidate > &vEvictionCandidates)
Protect desirable or disadvantaged inbound peers from eviction by ratio.
Definition: eviction.cpp:105
int64_t NodeId
Definition: net.h:97
Network
A network type.
Definition: netaddress.h:32
std::chrono::seconds m_last_tx_time
Definition: eviction.h:23
std::chrono::seconds m_connected
Definition: eviction.h:20
std::chrono::seconds m_last_block_time
Definition: eviction.h:22
ConnectionType m_conn_type
Definition: eviction.h:32
std::chrono::microseconds m_min_ping_time
Definition: eviction.h:21
uint64_t nKeyedNetGroup
Definition: eviction.h:27