Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

#include <quorums_signing_shares.h>

+ Inheritance diagram for llmq::CSigSharesManager:
+ Collaboration diagram for llmq::CSigSharesManager:

Public Member Functions

 CSigSharesManager ()
 
 ~CSigSharesManager ()
 
void StartWorkerThread ()
 
void StopWorkerThread ()
 
void RegisterAsRecoveredSigsListener ()
 
void UnregisterAsRecoveredSigsListener ()
 
void InterruptWorkerThread ()
 
void ProcessMessage (CNode *pnode, const std::string &strCommand, CDataStream &vRecv, CConnman &connman)
 
void AsyncSign (const CQuorumCPtr &quorum, const uint256 &id, const uint256 &msgHash)
 
void Sign (const CQuorumCPtr &quorum, const uint256 &id, const uint256 &msgHash)
 
void ForceReAnnouncement (const CQuorumCPtr &quorum, Consensus::LLMQType llmqType, const uint256 &id, const uint256 &msgHash)
 
void HandleNewRecoveredSig (const CRecoveredSig &recoveredSig)
 
- Public Member Functions inherited from llmq::CRecoveredSigsListener
virtual ~CRecoveredSigsListener ()
 

Static Public Member Functions

static CDeterministicMNCPtr SelectMemberForRecovery (const CQuorumCPtr &quorum, const uint256 &id, int attempt)
 

Private Member Functions

bool ProcessMessageSigSesAnn (CNode *pfrom, const CSigSesAnn &ann, CConnman &connman)
 
bool ProcessMessageSigSharesInv (CNode *pfrom, const CSigSharesInv &inv, CConnman &connman)
 
bool ProcessMessageGetSigShares (CNode *pfrom, const CSigSharesInv &inv, CConnman &connman)
 
bool ProcessMessageBatchedSigShares (CNode *pfrom, const CBatchedSigShares &batchedSigShares, CConnman &connman)
 
void ProcessMessageSigShare (NodeId fromId, const CSigShare &sigShare, CConnman &connman)
 
bool VerifySigSharesInv (NodeId from, Consensus::LLMQType llmqType, const CSigSharesInv &inv)
 
bool PreVerifyBatchedSigShares (NodeId nodeId, const CSigSharesNodeState::SessionInfo &session, const CBatchedSigShares &batchedSigShares, bool &retBan)
 
void CollectPendingSigSharesToVerify (size_t maxUniqueSessions, std::unordered_map< NodeId, std::vector< CSigShare >> &retSigShares, std::unordered_map< std::pair< Consensus::LLMQType, uint256 >, CQuorumCPtr, StaticSaltedHasher > &retQuorums)
 
bool ProcessPendingSigShares (CConnman &connman)
 
void ProcessPendingSigSharesFromNode (NodeId nodeId, const std::vector< CSigShare > &sigShares, const std::unordered_map< std::pair< Consensus::LLMQType, uint256 >, CQuorumCPtr, StaticSaltedHasher > &quorums, CConnman &connman)
 
void ProcessSigShare (NodeId nodeId, const CSigShare &sigShare, CConnman &connman, const CQuorumCPtr &quorum)
 
void TryRecoverSig (const CQuorumCPtr &quorum, const uint256 &id, const uint256 &msgHash, CConnman &connman)
 
bool GetSessionInfoByRecvId (NodeId nodeId, uint32_t sessionId, CSigSharesNodeState::SessionInfo &retInfo)
 
CSigShare RebuildSigShare (const CSigSharesNodeState::SessionInfo &session, const CBatchedSigShares &batchedSigShares, size_t idx)
 
void Cleanup ()
 
void RemoveSigSharesForSession (const uint256 &signHash)
 
void RemoveBannedNodeStates ()
 
void BanNode (NodeId nodeId)
 
bool SendMessages ()
 
void CollectSigSharesToRequest (std::unordered_map< NodeId, std::unordered_map< uint256, CSigSharesInv, StaticSaltedHasher >> &sigSharesToRequest)
 
void CollectSigSharesToSend (std::unordered_map< NodeId, std::unordered_map< uint256, CBatchedSigShares, StaticSaltedHasher >> &sigSharesToSend)
 
void CollectSigSharesToSendConcentrated (std::unordered_map< NodeId, std::vector< CSigShare >> &sigSharesToSend, const std::vector< CNode *> &vNodes)
 
void CollectSigSharesToAnnounce (std::unordered_map< NodeId, std::unordered_map< uint256, CSigSharesInv, StaticSaltedHasher >> &sigSharesToAnnounce)
 
bool SignPendingSigShares ()
 
void WorkThreadMain ()
 

Private Attributes

const size_t MAX_MSGS_CNT_QSIGSESANN = 100
 
const size_t MAX_MSGS_CNT_QGETSIGSHARES = 200
 
const size_t MAX_MSGS_CNT_QSIGSHARESINV = 200
 
const size_t MAX_MSGS_TOTAL_BATCHED_SIGS = 400
 
const int64_t EXP_SEND_FOR_RECOVERY_TIMEOUT = 2000
 
const int64_t MAX_SEND_FOR_RECOVERY_TIMEOUT = 10000
 
const size_t MAX_MSGS_SIG_SHARES = 32
 
CCriticalSection cs
 
std::thread workThread
 
CThreadInterrupt workInterrupt
 
SigShareMap< CSigSharesigShares
 
std::unordered_map< uint256, CSignedSession, StaticSaltedHashersignedSessions
 
std::unordered_map< uint256, int64_t, StaticSaltedHashertimeSeenForSessions
 
std::unordered_map< NodeId, CSigSharesNodeStatenodeStates
 
SigShareMap< std::pair< NodeId, int64_t > > sigSharesRequested
 
SigShareMap< bool > sigSharesToAnnounce
 
std::vector< std::tuple< const CQuorumCPtr, uint256, uint256 > > pendingSigns
 
FastRandomContext rnd
 
int64_t lastCleanupTime {0}
 
std::atomic< uint32_t > recoveredSigsCounter {0}
 

Static Private Attributes

static const int64_t SESSION_NEW_SHARES_TIMEOUT = 60
 
static const int64_t SIG_SHARE_REQUEST_TIMEOUT = 5
 

Detailed Description

Definition at line 355 of file quorums_signing_shares.h.

Constructor & Destructor Documentation

◆ CSigSharesManager()

llmq::CSigSharesManager::CSigSharesManager ( )

Definition at line 185 of file quorums_signing_shares.cpp.

References CThreadInterrupt::reset(), and workInterrupt.

◆ ~CSigSharesManager()

llmq::CSigSharesManager::~CSigSharesManager ( )

Definition at line 190 of file quorums_signing_shares.cpp.

Member Function Documentation

◆ AsyncSign()

void llmq::CSigSharesManager::AsyncSign ( const CQuorumCPtr quorum,
const uint256 id,
const uint256 msgHash 
)

◆ BanNode()

void llmq::CSigSharesManager::BanNode ( NodeId  nodeId)
private

◆ Cleanup()

◆ CollectPendingSigSharesToVerify()

void llmq::CSigSharesManager::CollectPendingSigSharesToVerify ( size_t  maxUniqueSessions,
std::unordered_map< NodeId, std::vector< CSigShare >> &  retSigShares,
std::unordered_map< std::pair< Consensus::LLMQType, uint256 >, CQuorumCPtr, StaticSaltedHasher > &  retQuorums 
)
private

◆ CollectSigSharesToAnnounce()

void llmq::CSigSharesManager::CollectSigSharesToAnnounce ( std::unordered_map< NodeId, std::unordered_map< uint256, CSigSharesInv, StaticSaltedHasher >> &  sigSharesToAnnounce)
private

◆ CollectSigSharesToRequest()

◆ CollectSigSharesToSend()

void llmq::CSigSharesManager::CollectSigSharesToSend ( std::unordered_map< NodeId, std::unordered_map< uint256, CBatchedSigShares, StaticSaltedHasher >> &  sigSharesToSend)
private

◆ CollectSigSharesToSendConcentrated()

void llmq::CSigSharesManager::CollectSigSharesToSendConcentrated ( std::unordered_map< NodeId, std::vector< CSigShare >> &  sigSharesToSend,
const std::vector< CNode *> &  vNodes 
)
private

◆ ForceReAnnouncement()

◆ GetSessionInfoByRecvId()

bool llmq::CSigSharesManager::GetSessionInfoByRecvId ( NodeId  nodeId,
uint32_t  sessionId,
CSigSharesNodeState::SessionInfo retInfo 
)
private

◆ HandleNewRecoveredSig()

void llmq::CSigSharesManager::HandleNewRecoveredSig ( const CRecoveredSig recoveredSig)
virtual

◆ InterruptWorkerThread()

void llmq::CSigSharesManager::InterruptWorkerThread ( )

Definition at line 228 of file quorums_signing_shares.cpp.

References workInterrupt.

Referenced by llmq::InterruptLLMQSystem().

◆ PreVerifyBatchedSigShares()

◆ ProcessMessage()

◆ ProcessMessageBatchedSigShares()

◆ ProcessMessageGetSigShares()

◆ ProcessMessageSigSesAnn()

◆ ProcessMessageSigShare()

◆ ProcessMessageSigSharesInv()

◆ ProcessPendingSigShares()

◆ ProcessPendingSigSharesFromNode()

void llmq::CSigSharesManager::ProcessPendingSigSharesFromNode ( NodeId  nodeId,
const std::vector< CSigShare > &  sigShares,
const std::unordered_map< std::pair< Consensus::LLMQType, uint256 >, CQuorumCPtr, StaticSaltedHasher > &  quorums,
CConnman connman 
)
private

◆ ProcessSigShare()

◆ RebuildSigShare()

◆ RegisterAsRecoveredSigsListener()

void llmq::CSigSharesManager::RegisterAsRecoveredSigsListener ( )

◆ RemoveBannedNodeStates()

void llmq::CSigSharesManager::RemoveBannedNodeStates ( )
private

◆ RemoveSigSharesForSession()

void llmq::CSigSharesManager::RemoveSigSharesForSession ( const uint256 signHash)
private

◆ SelectMemberForRecovery()

CDeterministicMNCPtr llmq::CSigSharesManager::SelectMemberForRecovery ( const CQuorumCPtr quorum,
const uint256 id,
int  attempt 
)
static

◆ SendMessages()

◆ Sign()

◆ SignPendingSigShares()

bool llmq::CSigSharesManager::SignPendingSigShares ( )
private

Definition at line 1543 of file quorums_signing_shares.cpp.

References cs, LOCK, pendingSigns, and Sign().

Referenced by WorkThreadMain().

◆ StartWorkerThread()

void llmq::CSigSharesManager::StartWorkerThread ( )

Definition at line 194 of file quorums_signing_shares.cpp.

References TraceThread(), workThread, and WorkThreadMain().

Referenced by llmq::StartLLMQSystem().

◆ StopWorkerThread()

void llmq::CSigSharesManager::StopWorkerThread ( )

Definition at line 206 of file quorums_signing_shares.cpp.

References workInterrupt, and workThread.

Referenced by llmq::StopLLMQSystem().

◆ TryRecoverSig()

◆ UnregisterAsRecoveredSigsListener()

void llmq::CSigSharesManager::UnregisterAsRecoveredSigsListener ( )

◆ VerifySigSharesInv()

bool llmq::CSigSharesManager::VerifySigSharesInv ( NodeId  from,
Consensus::LLMQType  llmqType,
const CSigSharesInv inv 
)
private

◆ WorkThreadMain()

Member Data Documentation

◆ cs

◆ EXP_SEND_FOR_RECOVERY_TIMEOUT

const int64_t llmq::CSigSharesManager::EXP_SEND_FOR_RECOVERY_TIMEOUT = 2000
private

Definition at line 367 of file quorums_signing_shares.h.

Referenced by CollectSigSharesToSendConcentrated().

◆ lastCleanupTime

int64_t llmq::CSigSharesManager::lastCleanupTime {0}
private

Definition at line 392 of file quorums_signing_shares.h.

Referenced by Cleanup().

◆ MAX_MSGS_CNT_QGETSIGSHARES

const size_t llmq::CSigSharesManager::MAX_MSGS_CNT_QGETSIGSHARES = 200
private

Definition at line 362 of file quorums_signing_shares.h.

Referenced by ProcessMessage(), and SendMessages().

◆ MAX_MSGS_CNT_QSIGSESANN

const size_t llmq::CSigSharesManager::MAX_MSGS_CNT_QSIGSESANN = 100
private

Definition at line 361 of file quorums_signing_shares.h.

Referenced by ProcessMessage(), and SendMessages().

◆ MAX_MSGS_CNT_QSIGSHARESINV

const size_t llmq::CSigSharesManager::MAX_MSGS_CNT_QSIGSHARESINV = 200
private

Definition at line 363 of file quorums_signing_shares.h.

Referenced by ProcessMessage(), and SendMessages().

◆ MAX_MSGS_SIG_SHARES

const size_t llmq::CSigSharesManager::MAX_MSGS_SIG_SHARES = 32
private

Definition at line 369 of file quorums_signing_shares.h.

Referenced by ProcessMessage(), and SendMessages().

◆ MAX_MSGS_TOTAL_BATCHED_SIGS

const size_t llmq::CSigSharesManager::MAX_MSGS_TOTAL_BATCHED_SIGS = 400
private

Definition at line 365 of file quorums_signing_shares.h.

Referenced by ProcessMessage(), and SendMessages().

◆ MAX_SEND_FOR_RECOVERY_TIMEOUT

const int64_t llmq::CSigSharesManager::MAX_SEND_FOR_RECOVERY_TIMEOUT = 10000
private

Definition at line 368 of file quorums_signing_shares.h.

Referenced by CollectSigSharesToSendConcentrated().

◆ nodeStates

◆ pendingSigns

std::vector<std::tuple<const CQuorumCPtr, uint256, uint256> > llmq::CSigSharesManager::pendingSigns
private

Definition at line 387 of file quorums_signing_shares.h.

Referenced by AsyncSign(), and SignPendingSigShares().

◆ recoveredSigsCounter

std::atomic<uint32_t> llmq::CSigSharesManager::recoveredSigsCounter {0}
private

Definition at line 393 of file quorums_signing_shares.h.

Referenced by TryRecoverSig().

◆ rnd

FastRandomContext llmq::CSigSharesManager::rnd
private

◆ SESSION_NEW_SHARES_TIMEOUT

const int64_t llmq::CSigSharesManager::SESSION_NEW_SHARES_TIMEOUT = 60
staticprivate

Definition at line 357 of file quorums_signing_shares.h.

Referenced by Cleanup().

◆ SIG_SHARE_REQUEST_TIMEOUT

const int64_t llmq::CSigSharesManager::SIG_SHARE_REQUEST_TIMEOUT = 5
staticprivate

Definition at line 358 of file quorums_signing_shares.h.

Referenced by CollectSigSharesToRequest().

◆ signedSessions

std::unordered_map<uint256, CSignedSession, StaticSaltedHasher> llmq::CSigSharesManager::signedSessions
private

◆ sigShares

◆ sigSharesRequested

SigShareMap<std::pair<NodeId, int64_t> > llmq::CSigSharesManager::sigSharesRequested
private

◆ sigSharesToAnnounce

SigShareMap<bool> llmq::CSigSharesManager::sigSharesToAnnounce
private

◆ timeSeenForSessions

std::unordered_map<uint256, int64_t, StaticSaltedHasher> llmq::CSigSharesManager::timeSeenForSessions
private

Definition at line 381 of file quorums_signing_shares.h.

Referenced by Cleanup(), ProcessSigShare(), and RemoveSigSharesForSession().

◆ workInterrupt

CThreadInterrupt llmq::CSigSharesManager::workInterrupt
private

◆ workThread

std::thread llmq::CSigSharesManager::workThread
private

Definition at line 374 of file quorums_signing_shares.h.

Referenced by StartWorkerThread(), and StopWorkerThread().


The documentation for this class was generated from the following files:
Released under the MIT license