refactor: Move stopafterblockimport handling out of blockstorage

This has the benefit of moving the StartShutdown call out of the
blockstorage file and thus out of the kernel's responsibility. The user
can now decide if he wants to start shutdown / interrupt after a block
import or not.
This commit is contained in:
TheCharlatan
2023-07-08 09:20:59 +02:00
committed by Sebastian Kung
parent ef29d5d7e2
commit 462390c85f
5 changed files with 7 additions and 13 deletions

View File

@@ -32,7 +32,6 @@ util::Result<void> ApplyArgsManOptions(const ArgsManager& args, BlockManager::Op
opts.prune_target = nPruneTarget;
if (auto value{args.GetBoolArg("-fastprune")}) opts.fast_prune = *value;
if (auto value{args.GetBoolArg("-stopafterblockimport")}) opts.stop_after_block_import = *value;
return {};
}

View File

@@ -946,12 +946,6 @@ void ImportBlocks(ChainstateManager& chainman, std::vector<fs::path> vImportFile
return;
}
}
if (chainman.m_blockman.StopAfterBlockImport()) {
LogPrintf("Stopping after block import\n");
StartShutdown();
return;
}
} // End scope of ImportingNow
}
} // namespace node

View File

@@ -213,8 +213,6 @@ public:
[[nodiscard]] bool LoadingBlocks() const { return m_importing || fReindex; }
[[nodiscard]] bool StopAfterBlockImport() const { return m_opts.stop_after_block_import; }
/** Calculate the amount of disk space the block & undo files currently use */
uint64_t CalculateCurrentUsage();