MCPcopy Create free account
hub / github.com/ElementsProject/elements / ComputeNextBlockAndDepth

Function ComputeNextBlockAndDepth

src/rpc/blockchain.cpp:159–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159static int ComputeNextBlockAndDepth(const CBlockIndex* tip, const CBlockIndex* blockindex, const CBlockIndex*& next)
160{
161 next = tip->GetAncestor(blockindex->nHeight + 1);
162 if (next && next->pprev == blockindex) {
163 return tip->nHeight - blockindex->nHeight + 1;
164 }
165 next = nullptr;
166 return blockindex == tip ? 1 : -1;
167}
168
169CBlockIndex* ParseHashOrHeight(const UniValue& param, ChainstateManager& chainman) {
170 LOCK(::cs_main);

Callers 1

blockheaderToJSONFunction · 0.85

Calls 1

GetAncestorMethod · 0.80

Tested by

no test coverage detected