static bool IsChainFile(std::string strFile)
{
- if (strFile == "coins.dat" || strFile == "chain.dat")
+ if (strFile == "coins.dat" || strFile == "blktree.dat")
return true;
return false;
//
-// CChainDB and CCoinsDB
+// CBlockTreeDB and CCoinsDB
//
bool CCoinsDB::HaveCoins(uint256 hash) {
return Write(make_pair('c', hash), coins);
}
-bool CChainDB::WriteBlockIndex(const CDiskBlockIndex& blockindex)
+bool CBlockTreeDB::WriteBlockIndex(const CDiskBlockIndex& blockindex)
{
return Write(make_pair('b', blockindex.GetBlockHash()), blockindex);
}
return Write('B', hashBestChain);
}
-bool CChainDB::ReadBestInvalidTrust(CBigNum& bnBestInvalidTrust)
+bool CBlockTreeDB::ReadBestInvalidTrust(CBigNum& bnBestInvalidTrust)
{
return Read('I', bnBestInvalidTrust);
}
-bool CChainDB::WriteBestInvalidTrust(CBigNum bnBestInvalidTrust)
+bool CBlockTreeDB::WriteBestInvalidTrust(CBigNum bnBestInvalidTrust)
{
return Write('I', bnBestInvalidTrust);
}
-bool CChainDB::WriteBlockFileInfo(int nFile, const CBlockFileInfo &info) {
+bool CBlockTreeDB::WriteBlockFileInfo(int nFile, const CBlockFileInfo &info) {
return Write(make_pair('f', nFile), info);
}
-bool CChainDB::ReadSyncCheckpoint(uint256& hashCheckpoint)
+bool CBlockTreeDB::ReadSyncCheckpoint(uint256& hashCheckpoint)
{
return Read('H', hashCheckpoint);
}
-bool CChainDB::WriteSyncCheckpoint(uint256 hashCheckpoint)
+bool CBlockTreeDB::WriteSyncCheckpoint(uint256 hashCheckpoint)
{
return Write('H', hashCheckpoint);
}
-bool CChainDB::ReadCheckpointPubKey(string& strPubKey)
+bool CBlockTreeDB::ReadCheckpointPubKey(string& strPubKey)
{
return Read('K', strPubKey);
}
-bool CChainDB::WriteCheckpointPubKey(const string& strPubKey)
+bool CBlockTreeDB::WriteCheckpointPubKey(const string& strPubKey)
{
return Write('K', strPubKey);
}
-bool CChainDB::ReadBlockFileInfo(int nFile, CBlockFileInfo &info) {
+bool CBlockTreeDB::ReadBlockFileInfo(int nFile, CBlockFileInfo &info) {
return Read(make_pair('f', nFile), info);
}
-bool CChainDB::WriteLastBlockFile(int nFile) {
+bool CBlockTreeDB::WriteLastBlockFile(int nFile) {
return Write('l', nFile);
}
-bool CChainDB::ReadLastBlockFile(int &nFile) {
+bool CBlockTreeDB::ReadLastBlockFile(int &nFile) {
return Read('l', nFile);
}
return pindexNew;
}
-bool LoadBlockIndex(CChainDB &chaindb)
+bool LoadBlockIndexDB()
{
- if (!chaindb.LoadBlockIndexGuts())
+ if (!pblocktree->LoadBlockIndexGuts())
return false;
if (fRequestShutdown)
}
// Load block file info
- chaindb.ReadLastBlockFile(nLastBlockFile);
+ pblocktree->ReadLastBlockFile(nLastBlockFile);
printf("LoadBlockIndex(): last block file = %i\n", nLastBlockFile);
- if (chaindb.ReadBlockFileInfo(nLastBlockFile, infoLastBlockFile))
+ if (pblocktree->ReadBlockFileInfo(nLastBlockFile, infoLastBlockFile))
printf("LoadBlockIndex(): last block file: %s\n", infoLastBlockFile.ToString().c_str());
// Load hashBestChain pointer to end of best chain
DateTimeStrFormat("%x %H:%M:%S", pindexBest->GetBlockTime()).c_str());
// Load sync-checkpoint
- if (!chaindb.ReadSyncCheckpoint(Checkpoints::hashSyncCheckpoint))
+ if (!pblocktree->ReadSyncCheckpoint(Checkpoints::hashSyncCheckpoint))
return error("CTxDB::LoadBlockIndex() : hashSyncCheckpoint not loaded");
printf("LoadBlockIndex(): synchronized checkpoint %s\n", Checkpoints::hashSyncCheckpoint.ToString().c_str());
// Load bnBestInvalidTrust, OK if it doesn't exist
CBigNum bnBestInvalidTrust;
- chaindb.ReadBestInvalidTrust(bnBestInvalidTrust);
+ pblocktree->ReadBestInvalidTrust(bnBestInvalidTrust);
nBestInvalidTrust = bnBestInvalidTrust.getuint256();
// Verify blocks in the best chain
-bool CChainDB::LoadBlockIndexGuts()
+bool CBlockTreeDB::LoadBlockIndexGuts()
{
// Get database cursor
Dbc* pcursor = GetCursor();