diff options
author | Carl Dong <contact@carldong.me> | 2022-03-15 19:19:58 -0400 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2022-03-15 19:42:43 -0400 |
commit | 28ba0313eac37e4a900b7e97af7169ce999c4024 (patch) | |
tree | 0e082ed3f96cbbefa53c23c1812d272d5a4862e9 /src/validation.cpp | |
parent | 12eb05df63f930969115af6dc66e2e5d02f2a517 (diff) |
Add and use CBlockIndexHeightOnlyComparator
...also use std::sort for clarity
Diffstat (limited to 'src/validation.cpp')
-rw-r--r-- | src/validation.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index eebb6773d4..2828b4ae98 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -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(); |