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

Function GetSkipHeight

src/chain.cpp:73–81  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

71
72/** Compute what height to jump back to with the CBlockIndex::pskip pointer. */
73int 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
83const CBlockIndex* CBlockIndex::GetAncestor(int height) const
84{

Callers 2

GetAncestorMethod · 0.85
BuildSkipMethod · 0.85

Calls 1

InvertLowestOneFunction · 0.85

Tested by

no test coverage detected