MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / GetSkipHeight

Function GetSkipHeight

src/chain.cpp:68–76  ·  view source on GitHub ↗

Compute what height to jump back to with the CBlockIndex::pskip pointer. */

Source from the content-addressed store, hash-verified

66
67/** Compute what height to jump back to with the CBlockIndex::pskip pointer. */
68int 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
78CBlockIndex* CBlockIndex::GetAncestor(int height)
79{

Callers 2

GetAncestorMethod · 0.85
BuildSkipMethod · 0.85

Calls 1

InvertLowestOneFunction · 0.85

Tested by

no test coverage detected