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

Method FindFork

src/chain.cpp:53–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53const CBlockIndex *CChain::FindFork(const CBlockIndex *pindex) const {
54 if (!pindex)
55 return nullptr;
56
57 if (pindex->nHeight > Height())
58 pindex = pindex->GetAncestor(Height());
59 while (pindex && !Contains(pindex))
60 pindex = pindex->pprev;
61 return pindex;
62}
63
64/** Turn the lowest '1' bit in the binary representation of a number into a '0'. */
65int static inline InvertLowestOne(int n) { return n & (n - 1); }

Callers 3

BOOST_FOREACHFunction · 0.80
ActivateBestChainStepFunction · 0.80
ActivateBestChainFunction · 0.80

Calls 1

GetAncestorMethod · 0.80

Tested by

no test coverage detected