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

Method WriteBatchSync

src/txdb.cpp:156–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154}
155
156bool CBlockTreeDB::WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo, int nLastFile, const std::vector<const CBlockIndex*>& blockinfo) {
157 CLevelDBBatch batch;
158 for (std::vector<std::pair<int, const CBlockFileInfo*> >::const_iterator it=fileInfo.begin(); it != fileInfo.end(); it++) {
159 batch.Write(make_pair(DB_BLOCK_FILES, it->first), *it->second);
160 }
161 batch.Write(DB_LAST_BLOCK, nLastFile);
162 for (std::vector<const CBlockIndex*>::const_iterator it=blockinfo.begin(); it != blockinfo.end(); it++) {
163 batch.Write(make_pair(DB_BLOCK_INDEX, (*it)->GetBlockHash()), CDiskBlockIndex(*it));
164 }
165 return WriteBatch(batch, true);
166}
167
168bool CBlockTreeDB::ReadTxIndex(const uint256 &txid, CDiskTxPos &pos) {
169 return Read(make_pair(DB_TXINDEX, txid), pos);

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