Skip to content

Commit

Permalink
Introduce global llmq::llmqDb instance of CDBWrapper
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
codablock committed Mar 8, 2019
1 parent acb52f6 commit e2cad1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/llmq/quorums_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,20 @@
#include "quorums_signing.h"
#include "quorums_signing_shares.h"

#include "dbwrapper.h"
#include "scheduler.h"

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);
Expand Down Expand Up @@ -51,6 +56,8 @@ void DestroyLLMQSystem()
quorumBlockProcessor = nullptr;
delete quorumDKGDebugManager;
quorumDKGDebugManager = nullptr;
delete llmqDb;
llmqDb = nullptr;
}

void StartLLMQSystem()
Expand Down
3 changes: 3 additions & 0 deletions src/llmq/quorums_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifndef DASH_QUORUMS_INIT_H
#define DASH_QUORUMS_INIT_H

class CDBWrapper;
class CEvoDB;
class CScheduler;

Expand All @@ -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();
Expand Down

0 comments on commit e2cad1b

Please sign in to comment.