validation: Remove review-only comments + assertions

[META] This is a followup to "validation: Move FindFilesToPrune{,Manual}
       to BlockManager" removing comments and assertions meant only to
       show that the change is correct.
pull/19927/head
Carl Dong 4 years ago
parent 3756853b15
commit 72a1d5c6f3
No known key found for this signature in database
GPG Key ID: 0CC52153197991A5

@ -2281,19 +2281,6 @@ bool CChainState::FlushStateToDisk(
CoinsCacheSizeState cache_state = GetCoinsCacheSizeState(&m_mempool);
LOCK(cs_LastBlockFile);
if (fPruneMode && (fCheckForPruning || nManualPruneHeight > 0) && !fReindex) {
// Previously, we called the global function ::ChainActive() in
// FindFilesToPrune{,Manual} to get the tip height and to determine
// whether or not a tip even exists. Now, we are simply passing in
// m_chain.Height() (which returns -1 if the tip doesn't exist). To
// make sure we're not changing behaviour, let's check that
// ::ChainActive() is the same object as m_chain (not just
// identical).
//
// This comment and the following assert will be removed in a
// subsequent commit, as they're just meant to demonstrate
// correctness (you can run tests against it and see that nothing
// exit unexpectedly).
assert(std::addressof(::ChainActive()) == std::addressof(m_chain));
if (nManualPruneHeight > 0) {
LOG_TIME_MILLIS_WITH_CATEGORY("find files to prune (manual)", BCLog::BENCH);
@ -2301,32 +2288,6 @@ bool CChainState::FlushStateToDisk(
} else {
LOG_TIME_MILLIS_WITH_CATEGORY("find files to prune", BCLog::BENCH);
// Previously, we called the global function
// ::ChainstateActive() in FindFilesToPrune{,Manual} to get the
// IBD status. Now, we are simply passing in
// IsInitialBlockDownload(). To make sure we're not changing
// behaviour, let's check that ::ChainstateActive() is the same
// object as *this (not just identical).
//
// This comment and the following assert will be removed in a
// subsequent commit, as they're just meant to demonstrate
// correctness (you can run tests against it and see that
// nothing exit unexpectedly).
assert(std::addressof(::ChainstateActive()) == std::addressof(*this));
// Previously, we called PruneOneBlockFile on g_chainman's
// m_blockman in FindFilesToPrune{,Manual}. Now, we are instead
// calling PruneOneBlockFile on _our_ m_blockman. To make sure
// we're not changing behaviour, let's check that
// g_chainman.m_blockman is the same object as _our_ m_blockman
// (not just identical).
//
// This comment and the following assert will be removed in a
// subsequent commit, as they're just meant to demonstrate
// correctness (you can run tests against it and see that
// nothing exit unexpectedly).
assert(std::addressof(g_chainman.m_blockman) == std::addressof(m_blockman));
m_blockman.FindFilesToPrune(setFilesToPrune, chainparams.PruneAfterHeight(), m_chain.Height(), IsInitialBlockDownload());
fCheckForPruning = false;
}

Loading…
Cancel
Save