MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / WriteBatchSync

Method WriteBatchSync

src/txdb.cpp:226–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224}
225
226bool CBlockTreeDB::WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo, int nLastFile, const std::vector<const CBlockIndex*>& blockinfo) {
227 CDBBatch batch(*this);
228 for (std::vector<std::pair<int, const CBlockFileInfo*> >::const_iterator it=fileInfo.begin(); it != fileInfo.end(); it++) {
229 batch.Write(std::make_pair(DB_BLOCK_FILES, it->first), *it->second);
230 }
231 batch.Write(DB_LAST_BLOCK, nLastFile);
232 for (std::vector<const CBlockIndex*>::const_iterator it=blockinfo.begin(); it != blockinfo.end(); it++) {
233 batch.Write(std::make_pair(DB_BLOCK_INDEX, (*it)->GetBlockHash()), CDiskBlockIndex(*it));
234 }
235 return WriteBatch(batch, true);
236}
237
238bool CBlockTreeDB::WriteFlag(const std::string &name, bool fValue) {
239 return Write(std::make_pair(DB_FLAG, name), fValue ? '1' : '0');

Callers 1

FlushStateToDiskFunction · 0.80

Calls 6

CDiskBlockIndexClass · 0.85
WriteBatchClass · 0.50
beginMethod · 0.45
endMethod · 0.45
WriteMethod · 0.45
GetBlockHashMethod · 0.45

Tested by

no test coverage detected