aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorstickies-v <stickies-v@protonmail.com>2023-10-19 12:46:32 +0100
committerstickies-v <stickies-v@protonmail.com>2024-08-06 00:23:38 +0100
commit2925bd537cbd8c70594e23f6c4298b7101f7f73d (patch)
tree55c109ee30047fb02aecd17b869b72dc1360e6bb /src/net_processing.cpp
parent949b67347255c0f2494055cbcdbb729a6476ded7 (diff)
refactor: use c++20 std::views::reverse instead of reverse_iterator.h
Use std::ranges::views::reverse instead of the implementation in reverse_iterator.h, and remove it as it is no longer used.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 0b9b8fbbe2..bf2c42548e 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -32,7 +32,6 @@
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <random.h>
-#include <reverse_iterator.h>
#include <scheduler.h>
#include <streams.h>
#include <sync.h>
@@ -51,6 +50,7 @@
#include <future>
#include <memory>
#include <optional>
+#include <ranges>
#include <typeinfo>
#include <utility>
@@ -2259,7 +2259,7 @@ void PeerManagerImpl::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlock
for (auto& it : m_peer_map) {
Peer& peer = *it.second;
LOCK(peer.m_block_inv_mutex);
- for (const uint256& hash : reverse_iterate(vHashes)) {
+ for (const uint256& hash : vHashes | std::views::reverse) {
peer.m_blocks_for_headers_relay.push_back(hash);
}
}
@@ -2958,7 +2958,7 @@ void PeerManagerImpl::HeadersDirectFetchBlocks(CNode& pfrom, const Peer& peer, c
} else {
std::vector<CInv> vGetData;
// Download as much as possible, from earliest to latest.
- for (const CBlockIndex *pindex : reverse_iterate(vToFetch)) {
+ for (const CBlockIndex* pindex : vToFetch | std::views::reverse) {
if (nodestate->vBlocksInFlight.size() >= MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
// Can't download any more from this peer
break;