| 114 | }; |
| 115 | |
| 116 | bool CBlockIndexWorkComparator::operator()(const CBlockIndex *pa, const CBlockIndex *pb) const { |
| 117 | // First sort by most total work, ... |
| 118 | if (pa->nChainWork > pb->nChainWork) return false; |
| 119 | if (pa->nChainWork < pb->nChainWork) return true; |
| 120 | |
| 121 | // ... then by earliest time received, ... |
| 122 | if (pa->nSequenceId < pb->nSequenceId) return false; |
| 123 | if (pa->nSequenceId > pb->nSequenceId) return true; |
| 124 | |
| 125 | // Use pointer address as tie breaker (should only happen with blocks |
| 126 | // loaded from disk, as those all have id 0). |
| 127 | if (pa < pb) return false; |
| 128 | if (pa > pb) return true; |
| 129 | |
| 130 | // Identical blocks. |
| 131 | return false; |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * Mutex to guard access to validation specific variables, such as reading |
nothing calls this directly
no test coverage detected