2022-11-07 19:09:44 +01:00
|
|
|
// Copyright (c) 2018-2022 The Dash Core developers
|
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#ifndef BITCOIN_LLMQ_CONTEXT_H
|
|
|
|
#define BITCOIN_LLMQ_CONTEXT_H
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
class CBLSWorker;
|
2023-08-23 19:11:26 +02:00
|
|
|
class CChainState;
|
2022-11-07 19:09:44 +01:00
|
|
|
class CConnman;
|
|
|
|
class CDBWrapper;
|
|
|
|
class CEvoDB;
|
|
|
|
class CTxMemPool;
|
|
|
|
class CSporkManager;
|
2023-04-28 07:17:42 +02:00
|
|
|
class PeerManager;
|
2022-11-07 19:09:44 +01:00
|
|
|
|
|
|
|
namespace llmq {
|
|
|
|
class CDKGDebugManager;
|
|
|
|
class CQuorumBlockProcessor;
|
|
|
|
class CDKGSessionManager;
|
|
|
|
class CQuorumManager;
|
|
|
|
class CSigSharesManager;
|
|
|
|
class CSigningManager;
|
|
|
|
class CChainLocksHandler;
|
|
|
|
class CInstantSendManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct LLMQContext {
|
2023-07-30 03:23:02 +02:00
|
|
|
LLMQContext() = delete;
|
|
|
|
LLMQContext(const LLMQContext&) = delete;
|
2023-08-23 19:11:26 +02:00
|
|
|
LLMQContext(CChainState& chainstate, CConnman& connman, CEvoDB& evo_db, CSporkManager& sporkman, CTxMemPool& mempool,
|
2023-04-28 07:17:42 +02:00
|
|
|
const std::unique_ptr<PeerManager>& peerman, bool unit_tests, bool wipe);
|
2022-11-07 19:09:44 +01:00
|
|
|
~LLMQContext();
|
|
|
|
|
|
|
|
void Interrupt();
|
|
|
|
void Start();
|
|
|
|
void Stop();
|
|
|
|
|
2023-07-30 03:23:02 +02:00
|
|
|
/** Guaranteed if LLMQContext is initialized then all members are valid too
|
|
|
|
*
|
|
|
|
* Please note, that members here should not be re-ordered, because initialization
|
|
|
|
* some of them requires other member initialized.
|
|
|
|
* For example, constructor `quorumManager` requires `bls_worker`.
|
|
|
|
*
|
|
|
|
* Some objects are still global variables and their de-globalization is not trivial
|
|
|
|
* at this point. LLMQContext keeps just a pointer to them and doesn't own these objects,
|
|
|
|
* but it still guarantees that objects are created and valid
|
|
|
|
*/
|
|
|
|
const std::shared_ptr<CBLSWorker> bls_worker;
|
|
|
|
const std::unique_ptr<llmq::CDKGDebugManager> dkg_debugman;
|
|
|
|
llmq::CQuorumBlockProcessor* const quorum_block_processor;
|
|
|
|
const std::unique_ptr<llmq::CDKGSessionManager> qdkgsman;
|
|
|
|
llmq::CQuorumManager* const qman;
|
|
|
|
const std::unique_ptr<llmq::CSigningManager> sigman;
|
|
|
|
const std::unique_ptr<llmq::CSigSharesManager> shareman;
|
|
|
|
llmq::CChainLocksHandler* const clhandler;
|
|
|
|
llmq::CInstantSendManager* const isman;
|
2022-11-07 19:09:44 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // BITCOIN_LLMQ_CONTEXT_H
|