Changeset View
Changeset View
Standalone View
Standalone View
src/blockindexworkcomparator.h
// Copyright (c) 2018 The Bitcoin developers | // Copyright (c) 2018 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_BLOCK_INDEX_WORK_COMPARATOR_H | #ifndef BITCOIN_BLOCK_INDEX_WORK_COMPARATOR_H | ||||
#define BITCOIN_BLOCK_INDEX_WORK_COMPARATOR_H | #define BITCOIN_BLOCK_INDEX_WORK_COMPARATOR_H | ||||
// TODO: Split chain.h apart and only include CBlockIndex | // TODO: Split chain.h apart and only include CBlockIndex | ||||
#include "chain.h" | #include <chain.h> | ||||
struct CBlockIndexWorkComparator { | struct CBlockIndexWorkComparator { | ||||
bool operator()(const CBlockIndex *pa, const CBlockIndex *pb) const { | bool operator()(const CBlockIndex *pa, const CBlockIndex *pb) const { | ||||
// First sort by most total work, ... | // First sort by most total work, ... | ||||
if (pa->nChainWork > pb->nChainWork) { | if (pa->nChainWork > pb->nChainWork) { | ||||
return false; | return false; | ||||
} | } | ||||
if (pa->nChainWork < pb->nChainWork) { | if (pa->nChainWork < pb->nChainWork) { | ||||
Show All 26 Lines |