| 59 | */ |
| 60 | namespace { |
| 61 | struct CBlockIndexWorkComparator |
| 62 | { |
| 63 | bool operator()(const CBlockIndex *pa, const CBlockIndex *pb) const { |
| 64 | // First sort by most total work, ... |
| 65 | if (pa->nChainWork > pb->nChainWork) return false; |
| 66 | if (pa->nChainWork < pb->nChainWork) return true; |
| 67 | |
| 68 | // ... then by earliest time received, ... |
| 69 | if (pa->nSequenceId < pb->nSequenceId) return false; |
| 70 | if (pa->nSequenceId > pb->nSequenceId) return true; |
| 71 | |
| 72 | // Use pointer address as tie breaker (should only happen with blocks |
| 73 | // loaded from disk, as those all have id 0). |
| 74 | if (pa < pb) return false; |
| 75 | if (pa > pb) return true; |
| 76 | |
| 77 | // Identical blocks. |
| 78 | return false; |
| 79 | } |
| 80 | }; |
| 81 | } // anon namespace |
| 82 | |
| 83 | enum DisconnectResult |
no outgoing calls
no test coverage detected