MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / SetTip

Method SetTip

src/chain/chain.cpp:47–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47CBlockIndex *CChain::SetTip(CBlockIndex *pIndex) {
48 if (pIndex == nullptr) {
49 vChain.clear();
50 return nullptr;
51 }
52 vChain.resize(pIndex->height + 1);
53 while (pIndex && vChain[pIndex->height] != pIndex) {
54 vChain[pIndex->height] = pIndex;
55 pIndex = pIndex->pprev;
56 }
57 return pIndex;
58}
59
60CBlockLocator CChain::GetLocator(const CBlockIndex *pIndex) const {
61 int32_t nStep = 1;

Callers 5

UpdateTipFunction · 0.80
FindMostWorkChainFunction · 0.80
LoadBlockIndexDBFunction · 0.80
UnloadBlockIndexFunction · 0.80
disconnectblockFunction · 0.80

Calls 3

CBlockClass · 0.50
clearMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected