2019-01-29 15:53:14 +01:00
|
|
|
// Copyright (c) 2018-2019 The Dash Core developers
|
2018-11-23 15:42:09 +01:00
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#include "quorums_init.h"
|
|
|
|
|
2019-01-08 09:13:56 +01:00
|
|
|
#include "quorums.h"
|
2018-11-23 15:42:09 +01:00
|
|
|
#include "quorums_blockprocessor.h"
|
|
|
|
#include "quorums_commitment.h"
|
2019-01-22 14:20:32 +01:00
|
|
|
#include "quorums_chainlocks.h"
|
2019-01-08 09:55:19 +01:00
|
|
|
#include "quorums_debug.h"
|
2018-05-24 16:14:55 +02:00
|
|
|
#include "quorums_dkgsessionmgr.h"
|
2019-01-15 15:35:26 +01:00
|
|
|
#include "quorums_signing.h"
|
2019-01-17 16:42:03 +01:00
|
|
|
#include "quorums_signing_shares.h"
|
2018-11-23 15:42:09 +01:00
|
|
|
|
2018-12-03 14:07:21 +01:00
|
|
|
#include "scheduler.h"
|
|
|
|
|
2018-11-23 15:42:09 +01:00
|
|
|
namespace llmq
|
|
|
|
{
|
|
|
|
|
2018-05-24 16:14:55 +02:00
|
|
|
static CBLSWorker blsWorker;
|
|
|
|
|
2019-01-15 15:35:26 +01:00
|
|
|
void InitLLMQSystem(CEvoDB& evoDb, CScheduler* scheduler, bool unitTests)
|
2018-11-23 15:42:09 +01:00
|
|
|
{
|
2019-01-08 09:55:19 +01:00
|
|
|
quorumDKGDebugManager = new CDKGDebugManager(scheduler);
|
2018-11-23 15:42:09 +01:00
|
|
|
quorumBlockProcessor = new CQuorumBlockProcessor(evoDb);
|
2018-05-24 16:14:55 +02:00
|
|
|
quorumDKGSessionManager = new CDKGSessionManager(evoDb, blsWorker);
|
2019-01-08 09:13:56 +01:00
|
|
|
quorumManager = new CQuorumManager(evoDb, blsWorker, *quorumDKGSessionManager);
|
2019-01-17 16:42:03 +01:00
|
|
|
quorumSigSharesManager = new CSigSharesManager();
|
2019-01-15 15:35:26 +01:00
|
|
|
quorumSigningManager = new CSigningManager(unitTests);
|
2019-01-22 14:20:32 +01:00
|
|
|
chainLocksHandler = new CChainLocksHandler(scheduler);
|
2019-01-17 16:42:03 +01:00
|
|
|
|
|
|
|
quorumSigSharesManager->StartWorkerThread();
|
2018-11-23 15:42:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void DestroyLLMQSystem()
|
|
|
|
{
|
2019-01-17 16:42:03 +01:00
|
|
|
if (quorumSigSharesManager) {
|
|
|
|
quorumSigSharesManager->StopWorkerThread();
|
|
|
|
}
|
|
|
|
|
2019-01-22 14:20:32 +01:00
|
|
|
delete chainLocksHandler;
|
|
|
|
chainLocksHandler = nullptr;
|
2019-01-15 15:35:26 +01:00
|
|
|
delete quorumSigningManager;
|
|
|
|
quorumSigningManager = nullptr;
|
2019-01-17 16:42:03 +01:00
|
|
|
delete quorumSigSharesManager;
|
|
|
|
quorumSigSharesManager = nullptr;
|
2019-01-08 09:13:56 +01:00
|
|
|
delete quorumManager;
|
|
|
|
quorumManager = NULL;
|
2018-05-24 16:14:55 +02:00
|
|
|
delete quorumDKGSessionManager;
|
|
|
|
quorumDKGSessionManager = NULL;
|
2018-11-23 15:42:09 +01:00
|
|
|
delete quorumBlockProcessor;
|
|
|
|
quorumBlockProcessor = nullptr;
|
2019-01-08 09:55:19 +01:00
|
|
|
delete quorumDKGDebugManager;
|
|
|
|
quorumDKGDebugManager = nullptr;
|
2018-11-23 15:42:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|