From e2cad1bd69a2755f32ec81dcb076f4d9e2c5ecfd Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Fri, 8 Mar 2019 17:28:08 +0100 Subject: [PATCH] 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. --- src/llmq/quorums_init.cpp | 7 +++++++ src/llmq/quorums_init.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/llmq/quorums_init.cpp b/src/llmq/quorums_init.cpp index 578d9783e4..cdc2d3137f 100644 --- a/src/llmq/quorums_init.cpp +++ b/src/llmq/quorums_init.cpp @@ -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() diff --git a/src/llmq/quorums_init.h b/src/llmq/quorums_init.h index 9a5398d63c..e8906b9253 100644 --- a/src/llmq/quorums_init.h +++ b/src/llmq/quorums_init.h @@ -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();