Compute what height to jump back to with the CBlockIndex::pskip pointer. */
| 66 | |
| 67 | /** Compute what height to jump back to with the CBlockIndex::pskip pointer. */ |
| 68 | int static inline GetSkipHeight(int height) { |
| 69 | if (height < 2) |
| 70 | return 0; |
| 71 | |
| 72 | // Determine which height to jump back to. Any number strictly lower than height is acceptable, |
| 73 | // but the following expression seems to perform well in simulations (max 110 steps to go back |
| 74 | // up to 2**18 blocks). |
| 75 | return (height & 1) ? InvertLowestOne(InvertLowestOne(height - 1)) + 1 : InvertLowestOne(height); |
| 76 | } |
| 77 | |
| 78 | CBlockIndex* CBlockIndex::GetAncestor(int height) |
| 79 | { |
no test coverage detected