MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ComputeNextBlockAndDepth

Function ComputeNextBlockAndDepth

src/rpc/blockchain.cpp:126–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126static int ComputeNextBlockAndDepth(const CBlockIndex& tip, const CBlockIndex& blockindex, const CBlockIndex*& next)
127{
128 next = tip.GetAncestor(blockindex.nHeight + 1);
129 if (next && next->pprev == &blockindex) {
130 return tip.nHeight - blockindex.nHeight + 1;
131 }
132 next = nullptr;
133 return &blockindex == &tip ? 1 : -1;
134}
135
136static const CBlockIndex* ParseHashOrHeight(const UniValue& param, ChainstateManager& chainman)
137{

Callers 1

blockheaderToJSONFunction · 0.85

Calls 1

GetAncestorMethod · 0.45

Tested by

no test coverage detected