From 61e10f65124132bd28d958d043dec3129ef1e6ad Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Fri, 8 Mar 2019 17:30:34 +0100 Subject: [PATCH] Use llmqDb for CRecoveredSigsDb Instead of creating its own CDBWrapper internally. --- src/llmq/quorums_init.cpp | 2 +- src/llmq/quorums_signing.cpp | 8 ++++---- src/llmq/quorums_signing.h | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/llmq/quorums_init.cpp b/src/llmq/quorums_init.cpp index 29eac7e55..747b73e34 100644 --- a/src/llmq/quorums_init.cpp +++ b/src/llmq/quorums_init.cpp @@ -33,7 +33,7 @@ void InitLLMQSystem(CEvoDB& evoDb, CScheduler* scheduler, bool unitTests) quorumDKGSessionManager = new CDKGSessionManager(*llmqDb, blsWorker); quorumManager = new CQuorumManager(evoDb, blsWorker, *quorumDKGSessionManager); quorumSigSharesManager = new CSigSharesManager(); - quorumSigningManager = new CSigningManager(unitTests); + quorumSigningManager = new CSigningManager(*llmqDb, unitTests); chainLocksHandler = new CChainLocksHandler(scheduler); quorumInstantSendManager = new CInstantSendManager(scheduler); } diff --git a/src/llmq/quorums_signing.cpp b/src/llmq/quorums_signing.cpp index 7c2f4e0ce..8a7e9bb63 100644 --- a/src/llmq/quorums_signing.cpp +++ b/src/llmq/quorums_signing.cpp @@ -24,8 +24,8 @@ namespace llmq CSigningManager* quorumSigningManager; -CRecoveredSigsDb::CRecoveredSigsDb(bool fMemory) : - db(fMemory ? "" : (GetDataDir() / "llmq"), 1 << 20, fMemory) +CRecoveredSigsDb::CRecoveredSigsDb(CDBWrapper& _db) : + db(_db) { } @@ -290,8 +290,8 @@ void CRecoveredSigsDb::WriteVoteForId(Consensus::LLMQType llmqType, const uint25 ////////////////// -CSigningManager::CSigningManager(bool fMemory) : - db(fMemory) +CSigningManager::CSigningManager(CDBWrapper& llmqDb, bool fMemory) : + db(llmqDb) { } diff --git a/src/llmq/quorums_signing.h b/src/llmq/quorums_signing.h index 3c379e4bf..952f5021e 100644 --- a/src/llmq/quorums_signing.h +++ b/src/llmq/quorums_signing.h @@ -72,7 +72,7 @@ class CRecoveredSigsDb static const size_t MAX_CACHE_TRUNCATE_THRESHOLD = 50000; private: - CDBWrapper db; + CDBWrapper& db; CCriticalSection cs; std::unordered_map, std::pair, StaticSaltedHasher> hasSigForIdCache; @@ -80,7 +80,7 @@ private: std::unordered_map, StaticSaltedHasher> hasSigForHashCache; public: - CRecoveredSigsDb(bool fMemory); + CRecoveredSigsDb(CDBWrapper& _db); bool HasRecoveredSig(Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash); bool HasRecoveredSigForId(Consensus::LLMQType llmqType, const uint256& id); @@ -136,7 +136,7 @@ private: std::vector recoveredSigsListeners; public: - CSigningManager(bool fMemory); + CSigningManager(CDBWrapper& llmqDb, bool fMemory); bool AlreadyHave(const CInv& inv); bool GetRecoveredSigForGetData(const uint256& hash, CRecoveredSig& ret);