Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
node
eviction.h
Go to the documentation of this file.
1
// Copyright (c) 2022-present 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
8
#include <
node/connection_types.h
>
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
18
struct
NodeEvictionCandidate
{
19
NodeId
id
;
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
;
24
bool
fRelevantServices
;
25
bool
m_relay_txs
;
26
bool
fBloomFilter
;
27
uint64_t
nKeyedNetGroup
;
28
bool
prefer_evict
;
29
bool
m_is_local
;
30
Network
m_network
;
31
bool
m_noban
;
32
ConnectionType
m_conn_type
;
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
connection_types.h
ConnectionType
ConnectionType
Different types of connections to a peer.
Definition
connection_types.h:18
SelectNodeToEvict
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
ProtectEvictionCandidatesByRatio
void ProtectEvictionCandidatesByRatio(std::vector< NodeEvictionCandidate > &vEvictionCandidates)
Protect desirable or disadvantaged inbound peers from eviction by ratio.
Definition
eviction.cpp:105
NodeId
int64_t NodeId
Definition
net.h:103
net_permissions.h
Network
Network
A network type.
Definition
netaddress.h:33
NodeEvictionCandidate
Definition
eviction.h:18
NodeEvictionCandidate::prefer_evict
bool prefer_evict
Definition
eviction.h:28
NodeEvictionCandidate::m_last_tx_time
std::chrono::seconds m_last_tx_time
Definition
eviction.h:23
NodeEvictionCandidate::id
NodeId id
Definition
eviction.h:19
NodeEvictionCandidate::m_network
Network m_network
Definition
eviction.h:30
NodeEvictionCandidate::m_relay_txs
bool m_relay_txs
Definition
eviction.h:25
NodeEvictionCandidate::m_connected
std::chrono::seconds m_connected
Definition
eviction.h:20
NodeEvictionCandidate::m_is_local
bool m_is_local
Definition
eviction.h:29
NodeEvictionCandidate::m_last_block_time
std::chrono::seconds m_last_block_time
Definition
eviction.h:22
NodeEvictionCandidate::m_noban
bool m_noban
Definition
eviction.h:31
NodeEvictionCandidate::m_conn_type
ConnectionType m_conn_type
Definition
eviction.h:32
NodeEvictionCandidate::fRelevantServices
bool fRelevantServices
Definition
eviction.h:24
NodeEvictionCandidate::fBloomFilter
bool fBloomFilter
Definition
eviction.h:26
NodeEvictionCandidate::m_min_ping_time
std::chrono::microseconds m_min_ping_time
Definition
eviction.h:21
NodeEvictionCandidate::nKeyedNetGroup
uint64_t nKeyedNetGroup
Definition
eviction.h:27
Generated on
for Bitcoin Core by
1.17.0