Compute what height to jump back to with the CBlockIndex::pskip pointer. */
| 4944 | |
| 4945 | /** Compute what height to jump back to with the CBlockIndex::pskip pointer. */ |
| 4946 | int static inline GetSkipHeight(int height) |
| 4947 | { |
| 4948 | if (height < 2) |
| 4949 | return 0; |
| 4950 | |
| 4951 | // Determine which height to jump back to. Any number strictly lower than height is acceptable, |
| 4952 | // but the following expression seems to perform well in simulations (max 110 steps to go back |
| 4953 | // up to 2**18 blocks). |
| 4954 | return (height & 1) ? InvertLowestOne(InvertLowestOne(height - 1)) + 1 : InvertLowestOne(height); |
| 4955 | } |
| 4956 | |
| 4957 | const CBlockIndex* CBlockIndex::GetAncestor(int height) const |
| 4958 | { |
no test coverage detected