mirror of https://github.com/bitcoin/bitcoin.git
Merge 80ac0467ef
into b510893d00
This commit is contained in:
commit
a70af9b77f
|
@ -158,20 +158,18 @@ namespace node {
|
|||
bool CBlockIndexWorkComparator::operator()(const CBlockIndex* pa, const CBlockIndex* pb) const
|
||||
{
|
||||
// First sort by most total work, ...
|
||||
if (pa->nChainWork > pb->nChainWork) return false;
|
||||
if (pa->nChainWork < pb->nChainWork) return true;
|
||||
if (pa->nChainWork != pb->nChainWork) {
|
||||
return pa->nChainWork < pb->nChainWork;
|
||||
}
|
||||
|
||||
// ... then by earliest time received, ...
|
||||
if (pa->nSequenceId < pb->nSequenceId) return false;
|
||||
if (pa->nSequenceId > pb->nSequenceId) return true;
|
||||
if (pa->nSequenceId != pb->nSequenceId) {
|
||||
return pa->nSequenceId > pb->nSequenceId;
|
||||
}
|
||||
|
||||
// Use pointer address as tie breaker (should only happen with blocks
|
||||
// loaded from disk, as those all have id 0).
|
||||
if (pa < pb) return false;
|
||||
if (pa > pb) return true;
|
||||
|
||||
// Identical blocks.
|
||||
return false;
|
||||
return pa > pb;
|
||||
}
|
||||
|
||||
bool CBlockIndexHeightOnlyComparator::operator()(const CBlockIndex* pa, const CBlockIndex* pb) const
|
||||
|
|
Loading…
Reference in New Issue