mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
Merge 153a6882f4 into merged_master (Bitcoin PR bitcoin/bitcoin#27576)
This commit is contained in:
commit
3af56ffbe7
27 changed files with 168 additions and 172 deletions
|
|
@ -11,7 +11,6 @@
|
|||
#include <arith_uint256.h>
|
||||
#include <chain.h>
|
||||
#include <checkqueue.h>
|
||||
#include <common/args.h>
|
||||
#include <consensus/amount.h>
|
||||
#include <consensus/consensus.h>
|
||||
#include <consensus/merkle.h>
|
||||
|
|
@ -2738,7 +2737,7 @@ bool Chainstate::FlushStateToDisk(
|
|||
// Write blocks and block index to disk.
|
||||
if (fDoFullFlush || fPeriodicWrite) {
|
||||
// Ensure we can write block index
|
||||
if (!CheckDiskSpace(gArgs.GetBlocksDirPath())) {
|
||||
if (!CheckDiskSpace(m_blockman.m_opts.blocks_dir)) {
|
||||
return AbortNode(state, "Disk space is too low!", _("Disk space is too low!"));
|
||||
}
|
||||
{
|
||||
|
|
@ -2816,7 +2815,7 @@ bool Chainstate::FlushStateToDisk(
|
|||
// twice (once in the log, and once in the tables). This is already
|
||||
// an overestimation, as most will delete an existing entry or
|
||||
// overwrite one. Still, use a conservative safety factor of 2.
|
||||
if (!CheckDiskSpace(gArgs.GetDataDirNet(), 48 * 2 * 2 * CoinsTip().GetCacheSize())) {
|
||||
if (!CheckDiskSpace(m_chainman.m_options.datadir, 48 * 2 * 2 * CoinsTip().GetCacheSize())) {
|
||||
return AbortNode(state, "Disk space is too low!", _("Disk space is too low!"));
|
||||
}
|
||||
// Flush the chainstate (which may refer to block index entries).
|
||||
|
|
@ -3430,7 +3429,6 @@ bool Chainstate::ActivateBestChain(BlockValidationState& state, std::shared_ptr<
|
|||
|
||||
CBlockIndex *pindexMostWork = nullptr;
|
||||
CBlockIndex *pindexNewTip = nullptr;
|
||||
int nStopAtHeight = gArgs.GetIntArg("-stopatheight", DEFAULT_STOPATHEIGHT);
|
||||
bool fStall = false;
|
||||
|
||||
do {
|
||||
|
|
@ -3517,7 +3515,7 @@ bool Chainstate::ActivateBestChain(BlockValidationState& state, std::shared_ptr<
|
|||
break;
|
||||
}
|
||||
|
||||
if (nStopAtHeight && pindexNewTip && pindexNewTip->nHeight >= nStopAtHeight) StartShutdown();
|
||||
if (m_chainman.StopAtHeight() && pindexNewTip && pindexNewTip->nHeight >= m_chainman.StopAtHeight()) StartShutdown();
|
||||
|
||||
if (WITH_LOCK(::cs_main, return m_disabled)) {
|
||||
// Background chainstate has reached the snapshot base block, so exit.
|
||||
|
|
@ -5581,7 +5579,7 @@ bool ChainstateManager::ActivateSnapshot(
|
|||
|
||||
// PopulateAndValidateSnapshot can return (in error) before the leveldb datadir
|
||||
// has been created, so only attempt removal if we got that far.
|
||||
if (auto snapshot_datadir = node::FindSnapshotChainstateDir()) {
|
||||
if (auto snapshot_datadir = node::FindSnapshotChainstateDir(m_options.datadir)) {
|
||||
// We have to destruct leveldb::DB in order to release the db lock, otherwise
|
||||
// DestroyDB() (in DeleteCoinsDBFromDisk()) will fail. See `leveldb::~DBImpl()`.
|
||||
// Destructing the chainstate (and so resetting the coinsviews object) does this.
|
||||
|
|
@ -6071,7 +6069,7 @@ ChainstateManager::~ChainstateManager()
|
|||
bool ChainstateManager::DetectSnapshotChainstate(CTxMemPool* mempool)
|
||||
{
|
||||
assert(!m_snapshot_chainstate);
|
||||
std::optional<fs::path> path = node::FindSnapshotChainstateDir();
|
||||
std::optional<fs::path> path = node::FindSnapshotChainstateDir(m_options.datadir);
|
||||
if (!path) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue