Bitcoin ABC 0.31.8
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
8#include <net_permissions.h>
10
11#include <chrono>
12#include <cstdint>
13#include <optional>
14#include <vector>
15
16typedef 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_proof_time;
24 std::chrono::seconds m_last_tx_time;
32 bool m_noban;
35};
36
44[[nodiscard]] std::optional<NodeId>
45SelectNodeToEvict(std::vector<NodeEvictionCandidate> &&vEvictionCandidates);
46
70 std::vector<NodeEvictionCandidate> &vEvictionCandidates);
71
72#endif // BITCOIN_NODE_EVICTION_H
ConnectionType
Different types of connections to a peer.
std::optional< NodeId > SelectNodeToEvict(std::vector< NodeEvictionCandidate > &&vEvictionCandidates)
Select an inbound peer to evict after filtering out (protecting) peers having distinct,...
Definition: eviction.cpp:261
int64_t NodeId
Definition: eviction.h:16
void ProtectEvictionCandidatesByRatio(std::vector< NodeEvictionCandidate > &vEvictionCandidates)
Protect desirable or disadvantaged inbound peers from eviction by ratio.
Definition: eviction.cpp:166
Network
A network type.
Definition: netaddress.h:44
std::chrono::seconds m_last_tx_time
Definition: eviction.h:24
double availabilityScore
Definition: eviction.h:34
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:33
std::chrono::microseconds m_min_ping_time
Definition: eviction.h:21
std::chrono::seconds m_last_proof_time
Definition: eviction.h:23
uint64_t nKeyedNetGroup
Definition: eviction.h:28