Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 2,071 Lines • ▼ Show 20 Lines | MinerFundSuccess: | ||||
LogPrint(BCLog::BENCH, " - Callbacks: %.2fms [%.2fs (%.2fms/blk)]\n", | LogPrint(BCLog::BENCH, " - Callbacks: %.2fms [%.2fs (%.2fms/blk)]\n", | ||||
MILLI * (nTime6 - nTime5), nTimeCallbacks * MICRO, | MILLI * (nTime6 - nTime5), nTimeCallbacks * MICRO, | ||||
nTimeCallbacks * MILLI / nBlocksTotal); | nTimeCallbacks * MILLI / nBlocksTotal); | ||||
return true; | return true; | ||||
} | } | ||||
CoinsCacheSizeState | CoinsCacheSizeState | ||||
CChainState::GetCoinsCacheSizeState(const CTxMemPool &tx_pool) { | CChainState::GetCoinsCacheSizeState(const CTxMemPool *tx_pool) { | ||||
return this->GetCoinsCacheSizeState( | return this->GetCoinsCacheSizeState( | ||||
tx_pool, m_coinstip_cache_size_bytes, | tx_pool, m_coinstip_cache_size_bytes, | ||||
gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000); | gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000); | ||||
} | } | ||||
CoinsCacheSizeState | CoinsCacheSizeState | ||||
CChainState::GetCoinsCacheSizeState(const CTxMemPool &tx_pool, | CChainState::GetCoinsCacheSizeState(const CTxMemPool *tx_pool, | ||||
size_t max_coins_cache_size_bytes, | size_t max_coins_cache_size_bytes, | ||||
size_t max_mempool_size_bytes) { | size_t max_mempool_size_bytes) { | ||||
int64_t nMempoolUsage = tx_pool.DynamicMemoryUsage(); | int64_t nMempoolUsage = tx_pool->DynamicMemoryUsage(); | ||||
int64_t cacheSize = CoinsTip().DynamicMemoryUsage(); | int64_t cacheSize = CoinsTip().DynamicMemoryUsage(); | ||||
int64_t nTotalSpace = | int64_t nTotalSpace = | ||||
max_coins_cache_size_bytes + | max_coins_cache_size_bytes + | ||||
std::max<int64_t>(max_mempool_size_bytes - nMempoolUsage, 0); | std::max<int64_t>(max_mempool_size_bytes - nMempoolUsage, 0); | ||||
//! No need to periodic flush if at least this much space still available. | //! No need to periodic flush if at least this much space still available. | ||||
static constexpr int64_t MAX_BLOCK_COINSDB_USAGE_BYTES = | static constexpr int64_t MAX_BLOCK_COINSDB_USAGE_BYTES = | ||||
10 * 1024 * 1024; // 10MB | 10 * 1024 * 1024; // 10MB | ||||
Show All 24 Lines | bool CChainState::FlushStateToDisk(const CChainParams &chainparams, | ||||
const size_t coins_count = CoinsTip().GetCacheSize(); | const size_t coins_count = CoinsTip().GetCacheSize(); | ||||
const size_t coins_mem_usage = CoinsTip().DynamicMemoryUsage(); | const size_t coins_mem_usage = CoinsTip().DynamicMemoryUsage(); | ||||
try { | try { | ||||
{ | { | ||||
bool fFlushForPrune = false; | bool fFlushForPrune = false; | ||||
bool fDoFullFlush = false; | bool fDoFullFlush = false; | ||||
CoinsCacheSizeState cache_state = | CoinsCacheSizeState cache_state = | ||||
GetCoinsCacheSizeState(::g_mempool); | GetCoinsCacheSizeState(&::g_mempool); | ||||
LOCK(cs_LastBlockFile); | LOCK(cs_LastBlockFile); | ||||
if (fPruneMode && (fCheckForPruning || nManualPruneHeight > 0) && | if (fPruneMode && (fCheckForPruning || nManualPruneHeight > 0) && | ||||
!fReindex) { | !fReindex) { | ||||
if (nManualPruneHeight > 0) { | if (nManualPruneHeight > 0) { | ||||
LOG_TIME_MILLIS_WITH_CATEGORY( | LOG_TIME_MILLIS_WITH_CATEGORY( | ||||
"find files to prune (manual)", BCLog::BENCH); | "find files to prune (manual)", BCLog::BENCH); | ||||
FindFilesToPruneManual(g_chainman, setFilesToPrune, | FindFilesToPruneManual(g_chainman, setFilesToPrune, | ||||
nManualPruneHeight); | nManualPruneHeight); | ||||
▲ Show 20 Lines • Show All 4,021 Lines • Show Last 20 Lines |