Compute what height to jump back to with the CBlockIndex::pskip pointer. */
| 101 | |
| 102 | /** Compute what height to jump back to with the CBlockIndex::pskip pointer. */ |
| 103 | int static inline GetSkipHeight(int height) { |
| 104 | if (height < 2) |
| 105 | return 0; |
| 106 | |
| 107 | // Determine which height to jump back to. Any number strictly lower than height is acceptable, |
| 108 | // but the following expression seems to perform well in simulations (max 110 steps to go back |
| 109 | // up to 2**18 blocks). |
| 110 | return (height & 1) ? InvertLowestOne(InvertLowestOne(height - 1)) + 1 : InvertLowestOne(height); |
| 111 | } |
| 112 | |
| 113 | const CBlockIndex* CBlockIndex::GetAncestor(int height) const |
| 114 | { |
no test coverage detected