Introduce global llmq::llmqDb instance of CDBWrapper

This DB is for LLMQ related data that is not part of on-chain consensus.
This for example included LLMQ secret key shares and recovered signatures.
This commit is contained in:
Alexander Block 2019-03-08 17:28:08 +01:00
parent acb52f6ec1
commit e2cad1bd69
2 changed files with 10 additions and 0 deletions

View File

@ -14,6 +14,7 @@
#include "quorums_signing.h"
#include "quorums_signing_shares.h"
#include "dbwrapper.h"
#include "scheduler.h"
namespace llmq
@ -21,8 +22,12 @@ namespace llmq
static CBLSWorker blsWorker;
CDBWrapper* llmqDb;
void InitLLMQSystem(CEvoDB& evoDb, CScheduler* scheduler, bool unitTests)
{
llmqDb = new CDBWrapper(unitTests ? "" : (GetDataDir() / "llmq"), 1 << 20, unitTests);
quorumDKGDebugManager = new CDKGDebugManager(scheduler);
quorumBlockProcessor = new CQuorumBlockProcessor(evoDb);
quorumDKGSessionManager = new CDKGSessionManager(evoDb, blsWorker);
@ -51,6 +56,8 @@ void DestroyLLMQSystem()
quorumBlockProcessor = nullptr;
delete quorumDKGDebugManager;
quorumDKGDebugManager = nullptr;
delete llmqDb;
llmqDb = nullptr;
}
void StartLLMQSystem()

View File

@ -5,6 +5,7 @@
#ifndef DASH_QUORUMS_INIT_H
#define DASH_QUORUMS_INIT_H
class CDBWrapper;
class CEvoDB;
class CScheduler;
@ -14,6 +15,8 @@ namespace llmq
// If true, we will connect to all new quorums and watch their communication
static const bool DEFAULT_WATCH_QUORUMS = false;
extern CDBWrapper* llmqDb;
// Init/destroy LLMQ globals
void InitLLMQSystem(CEvoDB& evoDb, CScheduler* scheduler, bool unitTests);
void DestroyLLMQSystem();