| 183 | namespace |
| 184 | { |
| 185 | struct CBlockIndexWorkComparator { |
| 186 | bool operator()(CBlockIndex* pa, CBlockIndex* pb) const |
| 187 | { |
| 188 | // First sort by most total work, ... |
| 189 | if (pa->nChainWork > pb->nChainWork) return false; |
| 190 | if (pa->nChainWork < pb->nChainWork) return true; |
| 191 | |
| 192 | // ... then by earliest time received, ... |
| 193 | if (pa->nSequenceId < pb->nSequenceId) return false; |
| 194 | if (pa->nSequenceId > pb->nSequenceId) return true; |
| 195 | |
| 196 | // Use pointer address as tie breaker (should only happen with blocks |
| 197 | // loaded from disk, as those all have id 0). |
| 198 | if (pa < pb) return false; |
| 199 | if (pa > pb) return true; |
| 200 | |
| 201 | // Identical blocks. |
| 202 | return false; |
| 203 | } |
| 204 | }; |
| 205 | |
| 206 | CBlockIndex* pindexBestInvalid; |
| 207 |
no outgoing calls
no test coverage detected