diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-12-16 13:30:48 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-12-16 13:30:55 +0100 |
commit | b440c33179e777bfebb8c12840e06ea691a4868f (patch) | |
tree | b8f283fac0425b08c7ebecb1ffcb8aeacbf2fcd7 /src/net.h | |
parent | dff0f6f753eafd932d7d65fbfa33585f620e8e54 (diff) | |
parent | fee88237e03c21bf81f21098e6b89ecfa5327cee (diff) |
Merge #20477: net: Add unit testing of node eviction logic
fee88237e03c21bf81f21098e6b89ecfa5327cee Assert eviction at >= 29 candidates. Assert non-eviction at <= 20 candidates. (practicalswift)
685c428de0fb63ca6ec1419bb112f07d27bcdf14 test: Add unit testing of node eviction logic (practicalswift)
ed73f8cee0d7b7facbd2e8dde24a237f20c48c0c net: Move eviction node selection logic to SelectNodeToEvict(...) (practicalswift)
Pull request description:
Add unit testing of node eviction logic.
Closes #19966.
ACKs for top commit:
jonatack:
ACK fee88237e03c21bf81f21098e6b89ecfa5327cee
MarcoFalke:
ACK fee88237e03c21bf81f21098e6b89ecfa5327cee 🐼
Tree-SHA512: 0827c35609122ca42bfabb17feaaee35c191ab4dc2e428282af425a6c176eaeaff2789b74a4f7eb4ca6b8cb10603068e90ca800e6ef3bc3904d50e76616f7a2b
Diffstat (limited to 'src/net.h')
-rw-r--r-- | src/net.h | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -33,6 +33,7 @@ #include <map> #include <memory> #include <thread> +#include <vector> class CScheduler; class CNode; @@ -1239,4 +1240,21 @@ inline std::chrono::microseconds PoissonNextSend(std::chrono::microseconds now, return std::chrono::microseconds{PoissonNextSend(now.count(), average_interval.count())}; } +struct NodeEvictionCandidate +{ + NodeId id; + int64_t nTimeConnected; + int64_t nMinPingUsecTime; + int64_t nLastBlockTime; + int64_t nLastTXTime; + bool fRelevantServices; + bool fRelayTxes; + bool fBloomFilter; + uint64_t nKeyedNetGroup; + bool prefer_evict; + bool m_is_local; +}; + +[[nodiscard]] Optional<NodeId> SelectNodeToEvict(std::vector<NodeEvictionCandidate>&& vEvictionCandidates); + #endif // BITCOIN_NET_H |