MCPcopy Create free account
hub / github.com/LUX-Core/lux / GetSkipHeight

Function GetSkipHeight

src/main.cpp:4946–4955  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

4944
4945/** Compute what height to jump back to with the CBlockIndex::pskip pointer. */
4946int 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
4957const CBlockIndex* CBlockIndex::GetAncestor(int height) const
4958{

Callers 2

GetAncestorMethod · 0.85
BuildSkipMethod · 0.85

Calls 1

InvertLowestOneFunction · 0.85

Tested by

no test coverage detected