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

Function UpdateBlockIndexDB

src/main.cpp:112–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110} // namespace
111
112static bool UpdateBlockIndexDB(CBlockIndex *pIndex) {
113 CDiskBlockIndex diskBlockIndex;
114 if (!pCdMan->pBlockIndexDb->GetBlockIndex(pIndex->GetBlockHash(), diskBlockIndex)) {
115 return ERRORMSG("the index of block=%s not exist in db", pIndex->GetIdString());
116 }
117 (CBlockIndex&)diskBlockIndex = *pIndex;
118 if (!pCdMan->pBlockIndexDb->WriteBlockIndex(diskBlockIndex)) {
119 return ERRORMSG("save index of block=%s not to db failed", pIndex->GetIdString());
120 }
121 return true;
122}
123
124//////////////////////////////////////////////////////////////////////////////
125//

Callers 2

InvalidateBlockIndexFunction · 0.85
ReconsiderBlockIndexFunction · 0.85

Calls 4

GetBlockIndexMethod · 0.80
GetIdStringMethod · 0.80
WriteBlockIndexMethod · 0.80
GetBlockHashMethod · 0.45

Tested by

no test coverage detected