mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-05 17:30:59 +02:00
refactor: rename fDoFullFlush to should_write
This commit is contained in:
parent
d73bd9fbe4
commit
b557fa7a17
@ -2831,7 +2831,6 @@ bool Chainstate::FlushStateToDisk(
|
|||||||
try {
|
try {
|
||||||
{
|
{
|
||||||
bool fFlushForPrune = false;
|
bool fFlushForPrune = false;
|
||||||
bool fDoFullFlush = false;
|
|
||||||
|
|
||||||
CoinsCacheSizeState cache_state = GetCoinsCacheSizeState();
|
CoinsCacheSizeState cache_state = GetCoinsCacheSizeState();
|
||||||
LOCK(m_blockman.cs_LastBlockFile);
|
LOCK(m_blockman.cs_LastBlockFile);
|
||||||
@ -2887,10 +2886,10 @@ bool Chainstate::FlushStateToDisk(
|
|||||||
bool fCacheCritical = mode == FlushStateMode::IF_NEEDED && cache_state >= CoinsCacheSizeState::CRITICAL;
|
bool fCacheCritical = mode == FlushStateMode::IF_NEEDED && cache_state >= CoinsCacheSizeState::CRITICAL;
|
||||||
// It's been a while since we wrote the block index and chain state to disk. Do this frequently, so we don't need to redownload or reindex after a crash.
|
// It's been a while since we wrote the block index and chain state to disk. Do this frequently, so we don't need to redownload or reindex after a crash.
|
||||||
bool fPeriodicWrite = mode == FlushStateMode::PERIODIC && nNow > m_last_write + DATABASE_WRITE_INTERVAL;
|
bool fPeriodicWrite = mode == FlushStateMode::PERIODIC && nNow > m_last_write + DATABASE_WRITE_INTERVAL;
|
||||||
// Combine all conditions that result in a full cache flush.
|
// Combine all conditions that result in a write to disk.
|
||||||
fDoFullFlush = (mode == FlushStateMode::ALWAYS) || fCacheLarge || fCacheCritical || fPeriodicWrite || fFlushForPrune;
|
bool should_write = (mode == FlushStateMode::ALWAYS) || fCacheLarge || fCacheCritical || fPeriodicWrite || fFlushForPrune;
|
||||||
// Write blocks, block index and best chain related state to disk.
|
// Write blocks, block index and best chain related state to disk.
|
||||||
if (fDoFullFlush) {
|
if (should_write) {
|
||||||
// Ensure we can write block index
|
// Ensure we can write block index
|
||||||
if (!CheckDiskSpace(m_blockman.m_opts.blocks_dir)) {
|
if (!CheckDiskSpace(m_blockman.m_opts.blocks_dir)) {
|
||||||
return FatalError(m_chainman.GetNotifications(), state, _("Disk space is too low!"));
|
return FatalError(m_chainman.GetNotifications(), state, _("Disk space is too low!"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user