| 112 | namespace { |
| 113 | |
| 114 | struct CBlockIndexWorkComparator |
| 115 | { |
| 116 | bool operator()(CBlockIndex *pa, 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 | CBlockIndex *pindexBestInvalid; |
| 136 |
no outgoing calls
no test coverage detected