mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-19 05:12:03 +02:00
refactor: Move block storage globals to blockstorage
However, keep a declaration in validation to make it possible to move smaller chunks to blockstorage without breaking compilation. Also, expose AbortNode in the header. Can be reviewed with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
This commit is contained in:
parent
fa81c30c6f
commit
fa247a327f
@ -21,6 +21,23 @@ bool fHavePruned = false;
|
|||||||
bool fPruneMode = false;
|
bool fPruneMode = false;
|
||||||
uint64_t nPruneTarget = 0;
|
uint64_t nPruneTarget = 0;
|
||||||
|
|
||||||
|
// TODO make namespace {
|
||||||
|
RecursiveMutex cs_LastBlockFile;
|
||||||
|
std::vector<CBlockFileInfo> vinfoBlockFile;
|
||||||
|
int nLastBlockFile = 0;
|
||||||
|
/** Global flag to indicate we should check to see if there are
|
||||||
|
* block/undo files that should be deleted. Set on startup
|
||||||
|
* or if we allocate more file space when we're in prune mode
|
||||||
|
*/
|
||||||
|
bool fCheckForPruning = false;
|
||||||
|
|
||||||
|
/** Dirty block index entries. */
|
||||||
|
std::set<CBlockIndex*> setDirtyBlockIndex;
|
||||||
|
|
||||||
|
/** Dirty block file entries. */
|
||||||
|
std::set<int> setDirtyFileInfo;
|
||||||
|
// } // namespace
|
||||||
|
|
||||||
bool IsBlockPruned(const CBlockIndex* pblockindex)
|
bool IsBlockPruned(const CBlockIndex* pblockindex)
|
||||||
{
|
{
|
||||||
return (fHavePruned && !(pblockindex->nStatus & BLOCK_HAVE_DATA) && pblockindex->nTx > 0);
|
return (fHavePruned && !(pblockindex->nStatus & BLOCK_HAVE_DATA) && pblockindex->nTx > 0);
|
||||||
|
@ -148,22 +148,16 @@ CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
|
|||||||
// Internal stuff
|
// Internal stuff
|
||||||
namespace {
|
namespace {
|
||||||
CBlockIndex* pindexBestInvalid = nullptr;
|
CBlockIndex* pindexBestInvalid = nullptr;
|
||||||
|
} // namespace
|
||||||
|
|
||||||
RecursiveMutex cs_LastBlockFile;
|
// Internal stuff from blockstorage ...
|
||||||
std::vector<CBlockFileInfo> vinfoBlockFile;
|
extern RecursiveMutex cs_LastBlockFile;
|
||||||
int nLastBlockFile = 0;
|
extern std::vector<CBlockFileInfo> vinfoBlockFile;
|
||||||
/** Global flag to indicate we should check to see if there are
|
extern int nLastBlockFile;
|
||||||
* block/undo files that should be deleted. Set on startup
|
extern bool fCheckForPruning;
|
||||||
* or if we allocate more file space when we're in prune mode
|
extern std::set<CBlockIndex*> setDirtyBlockIndex;
|
||||||
*/
|
extern std::set<int> setDirtyFileInfo;
|
||||||
bool fCheckForPruning = false;
|
// ... TODO move fully to blockstorage
|
||||||
|
|
||||||
/** Dirty block index entries. */
|
|
||||||
std::set<CBlockIndex*> setDirtyBlockIndex;
|
|
||||||
|
|
||||||
/** Dirty block file entries. */
|
|
||||||
std::set<int> setDirtyFileInfo;
|
|
||||||
} // anon namespace
|
|
||||||
|
|
||||||
CBlockIndex* BlockManager::LookupBlockIndex(const uint256& hash) const
|
CBlockIndex* BlockManager::LookupBlockIndex(const uint256& hash) const
|
||||||
{
|
{
|
||||||
@ -1515,7 +1509,7 @@ bool UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex* pindex)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool AbortNode(BlockValidationState& state, const std::string& strMessage, const bilingual_str& userMessage = bilingual_str())
|
bool AbortNode(BlockValidationState& state, const std::string& strMessage, const bilingual_str& userMessage)
|
||||||
{
|
{
|
||||||
AbortNode(strMessage, userMessage);
|
AbortNode(strMessage, userMessage);
|
||||||
return state.Error(strMessage);
|
return state.Error(strMessage);
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <serialize.h>
|
#include <serialize.h>
|
||||||
#include <util/check.h>
|
#include <util/check.h>
|
||||||
#include <util/hasher.h>
|
#include <util/hasher.h>
|
||||||
|
#include <util/translation.h>
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -161,6 +162,8 @@ void StopScriptCheckWorkerThreads();
|
|||||||
CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMemPool* const mempool, const uint256& hash, const Consensus::Params& consensusParams, uint256& hashBlock);
|
CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMemPool* const mempool, const uint256& hash, const Consensus::Params& consensusParams, uint256& hashBlock);
|
||||||
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
|
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
|
||||||
|
|
||||||
|
bool AbortNode(BlockValidationState& state, const std::string& strMessage, const bilingual_str& userMessage = bilingual_str{});
|
||||||
|
|
||||||
/** Guess verification progress (as a fraction between 0.0=genesis and 1.0=current tip). */
|
/** Guess verification progress (as a fraction between 0.0=genesis and 1.0=current tip). */
|
||||||
double GuessVerificationProgress(const ChainTxData& data, const CBlockIndex* pindex);
|
double GuessVerificationProgress(const ChainTxData& data, const CBlockIndex* pindex);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user