| 154 | } |
| 155 | |
| 156 | bool 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 | |
| 168 | bool CBlockTreeDB::ReadTxIndex(const uint256 &txid, CDiskTxPos &pos) { |
| 169 | return Read(make_pair(DB_TXINDEX, txid), pos); |
no test coverage detected