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