| 224 | } |
| 225 | |
| 226 | bool 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 | |
| 238 | bool CBlockTreeDB::WriteFlag(const std::string &name, bool fValue) { |
| 239 | return Write(std::make_pair(DB_FLAG, name), fValue ? '1' : '0'); |
no test coverage detected