| 51 | } |
| 52 | |
| 53 | const CBlockIndex *CChain::FindFork(const CBlockIndex *pindex) const { |
| 54 | if (!pindex) |
| 55 | return nullptr; |
| 56 | |
| 57 | if (pindex->nHeight > Height()) |
| 58 | pindex = pindex->GetAncestor(Height()); |
| 59 | while (pindex && !Contains(pindex)) |
| 60 | pindex = pindex->pprev; |
| 61 | return pindex; |
| 62 | } |
| 63 | |
| 64 | /** Turn the lowest '1' bit in the binary representation of a number into a '0'. */ |
| 65 | int static inline InvertLowestOne(int n) { return n & (n - 1); } |
no test coverage detected