mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Merge bitcoin/bitcoin#28687: C++20 std::views::reverse
2925bd537crefactor: use c++20 std::views::reverse instead of reverse_iterator.h (stickies-v) Pull request description: C++20 introduces [`std::ranges::views::reverse`](https://en.cppreference.com/w/cpp/ranges/reverse_view), which allows us to drop our own `reverse_iterator.h` implementation and also makes it easier to chain views (even though I think we currently don't use this). ACKs for top commit: achow101: ACK2925bd537cmaflcko: ACK2925bd537c🎷 Tree-SHA512: 567666ec44af5d1beb7a271836bcc89c4c577abc77f522fcc18bc6d4de516ae9b0df766d0bfa6dd217569e6878331c2aee1d9815620860375e3510dad7fed476
This commit is contained in:
commit
24ced52744
9 changed files with 22 additions and 66 deletions
|
|
@ -40,7 +40,6 @@
|
|||
#include <primitives/block.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <random.h>
|
||||
#include <reverse_iterator.h>
|
||||
#include <script/script.h>
|
||||
#include <script/sigcache.h>
|
||||
#include <signet.h>
|
||||
|
|
@ -70,6 +69,7 @@
|
|||
#include <deque>
|
||||
#include <numeric>
|
||||
#include <optional>
|
||||
#include <ranges>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
|
@ -3357,7 +3357,7 @@ bool Chainstate::ActivateBestChainStep(BlockValidationState& state, CBlockIndex*
|
|||
nHeight = nTargetHeight;
|
||||
|
||||
// Connect new blocks.
|
||||
for (CBlockIndex* pindexConnect : reverse_iterate(vpindexToConnect)) {
|
||||
for (CBlockIndex* pindexConnect : vpindexToConnect | std::views::reverse) {
|
||||
if (!ConnectTip(state, pindexConnect, pindexConnect == pindexMostWork ? pblock : std::shared_ptr<const CBlock>(), connectTrace, disconnectpool)) {
|
||||
if (state.IsInvalid()) {
|
||||
// The block violates a consensus rule.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue