Skip to content

Commit

Permalink
Use llmqDb for CRecoveredSigsDb
Browse files Browse the repository at this point in the history
Instead of creating its own CDBWrapper internally.
  • Loading branch information
codablock committed Mar 8, 2019
1 parent b2cd1db commit 61e10f6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/llmq/quorums_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions src/llmq/quorums_signing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}

Expand Down Expand Up @@ -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)
{
}

Expand Down
6 changes: 3 additions & 3 deletions src/llmq/quorums_signing.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ class CRecoveredSigsDb
static const size_t MAX_CACHE_TRUNCATE_THRESHOLD = 50000;

private:
CDBWrapper db;
CDBWrapper& db;

CCriticalSection cs;
std::unordered_map<std::pair<Consensus::LLMQType, uint256>, std::pair<bool, int64_t>, StaticSaltedHasher> hasSigForIdCache;
std::unordered_map<uint256, std::pair<bool, int64_t>, StaticSaltedHasher> hasSigForSessionCache;
std::unordered_map<uint256, std::pair<bool, int64_t>, 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);
Expand Down Expand Up @@ -136,7 +136,7 @@ class CSigningManager
std::vector<CRecoveredSigsListener*> recoveredSigsListeners;

public:
CSigningManager(bool fMemory);
CSigningManager(CDBWrapper& llmqDb, bool fMemory);

bool AlreadyHave(const CInv& inv);
bool GetRecoveredSigForGetData(const uint256& hash, CRecoveredSig& ret);
Expand Down

0 comments on commit 61e10f6

Please sign in to comment.