| 60 | } |
| 61 | |
| 62 | CBlockIndex* CChain::FindEarliestAtLeast(int64_t nTime) const |
| 63 | { |
| 64 | std::vector<CBlockIndex*>::const_iterator lower = std::lower_bound(vChain.begin(), vChain.end(), nTime, |
| 65 | [](CBlockIndex* pBlock, const int64_t& time) -> bool { return pBlock->GetBlockTimeMax() < time; }); |
| 66 | return (lower == vChain.end() ? nullptr : *lower); |
| 67 | } |
| 68 | |
| 69 | /** Turn the lowest '1' bit in the binary representation of a number into a '0'. */ |
| 70 | int static inline InvertLowestOne(int n) { return n & (n - 1); } |