mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-19 04:00:01 +01:00
Add and use CBlockIndexHeightOnlyComparator
...also use std::sort for clarity
This commit is contained in:
@@ -65,21 +65,22 @@
|
||||
using node::BLOCKFILE_CHUNK_SIZE;
|
||||
using node::BlockManager;
|
||||
using node::BlockMap;
|
||||
using node::CBlockIndexHeightOnlyComparator;
|
||||
using node::CBlockIndexWorkComparator;
|
||||
using node::CCoinsStats;
|
||||
using node::CoinStatsHashType;
|
||||
using node::fHavePruned;
|
||||
using node::fImporting;
|
||||
using node::fPruneMode;
|
||||
using node::fReindex;
|
||||
using node::GetUTXOStats;
|
||||
using node::nPruneTarget;
|
||||
using node::OpenBlockFile;
|
||||
using node::ReadBlockFromDisk;
|
||||
using node::SnapshotMetadata;
|
||||
using node::UNDOFILE_CHUNK_SIZE;
|
||||
using node::UndoReadFromDisk;
|
||||
using node::UnlinkPrunedFiles;
|
||||
using node::fHavePruned;
|
||||
using node::fImporting;
|
||||
using node::fPruneMode;
|
||||
using node::fReindex;
|
||||
using node::nPruneTarget;
|
||||
|
||||
#define MICRO 0.000001
|
||||
#define MILLI 0.001
|
||||
@@ -4073,10 +4074,8 @@ bool ChainstateManager::LoadBlockIndex()
|
||||
for (auto& [_, block_index] : m_blockman.m_block_index) {
|
||||
vSortedByHeight.push_back(&block_index);
|
||||
}
|
||||
sort(vSortedByHeight.begin(), vSortedByHeight.end(),
|
||||
[](const CBlockIndex* pa, const CBlockIndex* pb) {
|
||||
return pa->nHeight < pb->nHeight;
|
||||
});
|
||||
std::sort(vSortedByHeight.begin(), vSortedByHeight.end(),
|
||||
CBlockIndexHeightOnlyComparator());
|
||||
|
||||
// Find start of assumed-valid region.
|
||||
int first_assumed_valid_height = std::numeric_limits<int>::max();
|
||||
|
||||
Reference in New Issue
Block a user