Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 6,031 Lines • ▼ Show 20 Lines | double GuessVerificationProgress(const ChainTxData &data, | ||||
} else { | } else { | ||||
fTxTotal = pindex->GetChainTxCount() + | fTxTotal = pindex->GetChainTxCount() + | ||||
(nNow - pindex->GetBlockTime()) * data.dTxRate; | (nNow - pindex->GetBlockTime()) * data.dTxRate; | ||||
} | } | ||||
return std::min<double>(pindex->GetChainTxCount() / fTxTotal, 1.0); | return std::min<double>(pindex->GetChainTxCount() / fTxTotal, 1.0); | ||||
} | } | ||||
class CMainCleanup { | |||||
public: | |||||
CMainCleanup() {} | |||||
~CMainCleanup() { | |||||
// block headers | |||||
for (const std::pair<const BlockHash, CBlockIndex *> &it : | |||||
g_chainman.BlockIndex()) { | |||||
delete it.second; | |||||
} | |||||
g_chainman.BlockIndex().clear(); | |||||
} | |||||
}; | |||||
static CMainCleanup instance_of_cmaincleanup; | |||||
std::optional<BlockHash> ChainstateManager::SnapshotBlockhash() const { | std::optional<BlockHash> ChainstateManager::SnapshotBlockhash() const { | ||||
if (m_active_chainstate != nullptr) { | if (m_active_chainstate != nullptr) { | ||||
// If a snapshot chainstate exists, it will always be our active. | // If a snapshot chainstate exists, it will always be our active. | ||||
return m_active_chainstate->m_from_snapshot_blockhash; | return m_active_chainstate->m_from_snapshot_blockhash; | ||||
} | } | ||||
return {}; | return {}; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines |