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

Method Commit

src/index/base.cpp:276–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276bool BaseIndex::Commit()
277{
278 // Don't commit anything if we haven't indexed any block yet
279 // (this could happen if init is interrupted).
280 bool ok = m_best_block_index != nullptr;
281 if (ok) {
282 CDBBatch batch(GetDB());
283 ok = CustomCommit(batch);
284 if (ok) {
285 GetDB().WriteBestBlock(batch, GetLocator(*m_chain, m_best_block_index.load()->GetBlockHash()));
286 GetDB().WriteBatch(batch);
287 }
288 }
289 if (!ok) {
290 LogError("Failed to commit latest %s state", GetName());
291 return false;
292 }
293 return true;
294}
295
296bool BaseIndex::Rewind(const CBlockIndex* current_tip, const CBlockIndex* new_tip)
297{

Callers 3

CustomCommitMethod · 0.45
WriteFilterToDiskMethod · 0.45
DumpMempoolFunction · 0.45

Calls 5

GetLocatorFunction · 0.70
WriteBestBlockMethod · 0.45
GetBlockHashMethod · 0.45
loadMethod · 0.45
WriteBatchMethod · 0.45

Tested by

no test coverage detected