mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Merge bitcoin/bitcoin#26762: bugfix: Make CCheckQueue RAII-styled (attempt 2)
5b3ea5fa2erefactor: Move `{MAX,DEFAULT}_SCRIPTCHECK_THREADS` constants (Hennadii Stepanov)6e17b31680refactor: Make `CCheckQueue` non-copyable and non-movable explicitly (Hennadii Stepanov)8111e74653refactor: Drop unneeded declaration (Hennadii Stepanov)9cf89f7a5brefactor: Make `CCheckQueue` constructor start worker threads (Hennadii Stepanov)d03eaacbcfMake `CCheckQueue` destructor stop worker threads (Hennadii Stepanov)be4ff3060bMove global `scriptcheckqueue` into `ChainstateManager` class (Hennadii Stepanov) Pull request description: This PR: - makes `CCheckQueue` RAII-styled - gets rid of the global `scriptcheckqueue` - fixes https://github.com/bitcoin/bitcoin/issues/25448 The previous attempt was in https://github.com/bitcoin/bitcoin/pull/18731. ACKs for top commit: martinus: ACK5b3ea5fa2eachow101: ACK5b3ea5fa2eTheCharlatan: ACK5b3ea5fa2eTree-SHA512: 45cca846e7ed107e3930149f0b616ddbaf2648d6cde381f815331b861b5d67ab39e154883ae174b8abb1dae485bc904318c50c51e5d6b46923d89de51c5eadb0
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include <arith_uint256.h>
|
||||
#include <attributes.h>
|
||||
#include <chain.h>
|
||||
#include <checkqueue.h>
|
||||
#include <kernel/chain.h>
|
||||
#include <consensus/amount.h>
|
||||
#include <deploymentstatus.h>
|
||||
@@ -65,10 +66,6 @@ namespace util {
|
||||
class SignalInterrupt;
|
||||
} // namespace util
|
||||
|
||||
/** Maximum number of dedicated script-checking threads allowed */
|
||||
static const int MAX_SCRIPTCHECK_THREADS = 15;
|
||||
/** -par default (number of script-checking threads, 0 = auto) */
|
||||
static const int DEFAULT_SCRIPTCHECK_THREADS = 0;
|
||||
/** Block files containing a block-height within MIN_BLOCKS_TO_KEEP of ActiveChain().Tip() will not be pruned. */
|
||||
static const unsigned int MIN_BLOCKS_TO_KEEP = 288;
|
||||
static const signed int DEFAULT_CHECKBLOCKS = 6;
|
||||
@@ -98,11 +95,6 @@ extern uint256 g_best_block;
|
||||
/** Documentation for argument 'checklevel'. */
|
||||
extern const std::vector<std::string> CHECKLEVEL_DOC;
|
||||
|
||||
/** Run instances of script checking worker threads */
|
||||
void StartScriptCheckWorkerThreads(int threads_num);
|
||||
/** Stop all of the script checking worker threads */
|
||||
void StopScriptCheckWorkerThreads();
|
||||
|
||||
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
|
||||
|
||||
bool FatalError(kernel::Notifications& notifications, BlockValidationState& state, const std::string& strMessage, const bilingual_str& userMessage = {});
|
||||
@@ -926,6 +918,9 @@ private:
|
||||
return cs && !cs->m_disabled;
|
||||
}
|
||||
|
||||
//! A queue for script verifications that have to be performed by worker threads.
|
||||
CCheckQueue<CScriptCheck> m_script_check_queue;
|
||||
|
||||
public:
|
||||
using Options = kernel::ChainstateManagerOpts;
|
||||
|
||||
@@ -1276,6 +1271,8 @@ public:
|
||||
//! nullopt.
|
||||
std::optional<int> GetSnapshotBaseHeight() const EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||
|
||||
CCheckQueue<CScriptCheck>& GetCheckQueue() { return m_script_check_queue; }
|
||||
|
||||
~ChainstateManager();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user