Changeset View
Changeset View
Standalone View
Standalone View
src/txdb.cpp
Show First 20 Lines • Show All 257 Lines • ▼ Show 20 Lines | |||||
bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) { | bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) { | ||||
char ch; | char ch; | ||||
if (!Read(std::make_pair(DB_FLAG, name), ch)) return false; | if (!Read(std::make_pair(DB_FLAG, name), ch)) return false; | ||||
fValue = ch == '1'; | fValue = ch == '1'; | ||||
return true; | return true; | ||||
} | } | ||||
bool CBlockTreeDB::LoadBlockIndexGuts( | bool CBlockTreeDB::LoadBlockIndexGuts( | ||||
const Config &config, | const Consensus::Params ¶ms, | ||||
std::function<CBlockIndex *(const uint256 &)> insertBlockIndex) { | std::function<CBlockIndex *(const uint256 &)> insertBlockIndex) { | ||||
std::unique_ptr<CDBIterator> pcursor(NewIterator()); | std::unique_ptr<CDBIterator> pcursor(NewIterator()); | ||||
pcursor->Seek(std::make_pair(DB_BLOCK_INDEX, uint256())); | pcursor->Seek(std::make_pair(DB_BLOCK_INDEX, uint256())); | ||||
// Load mapBlockIndex | // Load mapBlockIndex | ||||
while (pcursor->Valid()) { | while (pcursor->Valid()) { | ||||
Show All 19 Lines | while (pcursor->Valid()) { | ||||
pindexNew->hashMerkleRoot = diskindex.hashMerkleRoot; | pindexNew->hashMerkleRoot = diskindex.hashMerkleRoot; | ||||
pindexNew->nTime = diskindex.nTime; | pindexNew->nTime = diskindex.nTime; | ||||
pindexNew->nBits = diskindex.nBits; | pindexNew->nBits = diskindex.nBits; | ||||
pindexNew->nNonce = diskindex.nNonce; | pindexNew->nNonce = diskindex.nNonce; | ||||
pindexNew->nStatus = diskindex.nStatus; | pindexNew->nStatus = diskindex.nStatus; | ||||
pindexNew->nTx = diskindex.nTx; | pindexNew->nTx = diskindex.nTx; | ||||
if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, | if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, | ||||
config)) { | params)) { | ||||
return error("%s: CheckProofOfWork failed: %s", __func__, | return error("%s: CheckProofOfWork failed: %s", __func__, | ||||
pindexNew->ToString()); | pindexNew->ToString()); | ||||
} | } | ||||
pcursor->Next(); | pcursor->Next(); | ||||
} | } | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 134 Lines • Show Last 20 Lines |