Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix error too many messages #370

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 24 additions & 14 deletions src/llmq/quorums_dkgsessionhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,30 @@ namespace llmq {

//////

// CDKGSessionHandler::CDKGSessionHandler(const Consensus::LLMQParams& _params, CBLSWorker& _blsWorker, CDKGSessionManager& _dkgManager) :
// params(_params),
// blsWorker(_blsWorker),
// dkgManager(_dkgManager),
// curSession(std::make_shared<CDKGSession>(_params, _blsWorker, _dkgManager)),
// pendingContributions(800, MSG_QUORUM_CONTRIB), // we allow size*2 messages as we need to make sure we see bad behavior (double messages)
// pendingComplaints(800, MSG_QUORUM_COMPLAINT),
// pendingJustifications(800, MSG_QUORUM_JUSTIFICATION),
// pendingPrematureCommitments(800, MSG_QUORUM_PREMATURE_COMMITMENT)
// {
// if (params.type == Consensus::LLMQ_NONE) {
// throw std::runtime_error("Can't initialize CDKGSessionHandler with LLMQ_NONE type.");
// }
// }
static int LlmqParamsSize(const Consensus::LLMQParams &_params) {
switch (_params.type) {
case Consensus::LLMQ_50_60: return 50; //llmq_50_60.size
case Consensus::LLMQ_400_60: return 400; //llmq_400_60.size
case Consensus::LLMQ_400_85: return 400; //llmq_400_85.size
}
return _params.size;
}

CDKGSessionHandler::CDKGSessionHandler(const Consensus::LLMQParams &_params, CBLSWorker &_blsWorker,
CDKGSessionManager &_dkgManager, CConnman &_connman) :
params(_params),
blsWorker(_blsWorker),
dkgManager(_dkgManager),
connman(_connman),
curSession(std::make_unique<CDKGSession>(_params, _blsWorker, _dkgManager, _connman)),
pendingContributions((size_t) LlmqParamsSize(_params) * 2,MSG_QUORUM_CONTRIB), // we allow size*2 messages as we need to make sure we see bad behavior (double messages)
pendingComplaints((size_t) LlmqParamsSize(_params) * 2, MSG_QUORUM_COMPLAINT),
pendingJustifications((size_t) LlmqParamsSize(_params) * 2, MSG_QUORUM_JUSTIFICATION),
pendingPrematureCommitments((size_t) LlmqParamsSize(_params) * 2, MSG_QUORUM_PREMATURE_COMMITMENT) {
if (params.type == Consensus::LLMQType::LLMQ_NONE) {
throw std::runtime_error("Can't initialize CDKGSessionHandler with LLMQ_NONE type.");
}
}

// CDKGSessionHandler::~CDKGSessionHandler() = default;

Expand Down
16 changes: 1 addition & 15 deletions src/llmq/quorums_dkgsessionhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,7 @@ namespace llmq {

public:
CDKGSessionHandler(const Consensus::LLMQParams &_params, CBLSWorker &_blsWorker,
CDKGSessionManager &_dkgManager, CConnman &_connman) :
params(_params),
blsWorker(_blsWorker),
dkgManager(_dkgManager),
connman(_connman),
curSession(std::make_unique<CDKGSession>(_params, _blsWorker, _dkgManager, _connman)),
pendingContributions((size_t) _params.size * 2,
MSG_QUORUM_CONTRIB), // we allow size*2 messages as we need to make sure we see bad behavior (double messages)
pendingComplaints((size_t) _params.size * 2, MSG_QUORUM_COMPLAINT),
pendingJustifications((size_t) _params.size * 2, MSG_QUORUM_JUSTIFICATION),
pendingPrematureCommitments((size_t) _params.size * 2, MSG_QUORUM_PREMATURE_COMMITMENT) {
if (params.type == Consensus::LLMQType::LLMQ_NONE) {
throw std::runtime_error("Can't initialize CDKGSessionHandler with LLMQ_NONE type.");
}
}
CDKGSessionManager &_dkgManager, CConnman &_connman);

~CDKGSessionHandler() = default;

Expand Down
Loading