Skip to content

Commit

Permalink
Introduce SPORK_18_QUORUM_DEBUG_ENABLED to enable/disable LLMQ debug …
Browse files Browse the repository at this point in the history
…messages
  • Loading branch information
codablock committed Jan 9, 2019
1 parent 324406b commit 352edbd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/llmq/quorums_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "net.h"
#include "net_processing.h"
#include "scheduler.h"
#include "spork.h"
#include "validation.h"

#include "evo/deterministicmns.h"
Expand Down Expand Up @@ -121,6 +122,10 @@ CDKGDebugManager::CDKGDebugManager(CScheduler* scheduler)

void CDKGDebugManager::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman)
{
if (!sporkManager.IsSporkActive(SPORK_18_QUORUM_DEBUG_ENABLED)) {
return;
}

if (strCommand == NetMsgType::QDEBUGSTATUS) {
CDKGDebugStatus status;
vRecv >> status;
Expand Down Expand Up @@ -237,6 +242,11 @@ UniValue CDKGDebugStatus::ToJson(int detailLevel) const
bool CDKGDebugManager::AlreadyHave(const CInv& inv)
{
LOCK(cs);

if (!sporkManager.IsSporkActive(SPORK_18_QUORUM_DEBUG_ENABLED)) {
return true;
}

return statuses.count(inv.hash) != 0;
}

Expand Down Expand Up @@ -320,6 +330,9 @@ void CDKGDebugManager::SendLocalStatus()
if (activeMasternodeInfo.proTxHash.IsNull()) {
return;
}
if (!sporkManager.IsSporkActive(SPORK_18_QUORUM_DEBUG_ENABLED)) {
return;
}

CDKGDebugStatus status;
{
Expand Down
3 changes: 3 additions & 0 deletions src/spork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ std::map<int, int64_t> mapSporkDefaults = {
{SPORK_12_RECONSIDER_BLOCKS, 0}, // 0 BLOCKS
{SPORK_16_INSTANTSEND_AUTOLOCKS, 4070908800ULL}, // OFF
{SPORK_17_QUORUM_DKG_ENABLED, 4070908800ULL}, // OFF
{SPORK_18_QUORUM_DEBUG_ENABLED, 4070908800ULL}, // OFF
};

bool CSporkManager::SporkValueIsActive(int nSporkID, int64_t &nActiveValueRet) const
Expand Down Expand Up @@ -285,6 +286,7 @@ int CSporkManager::GetSporkIDByName(const std::string& strName)
if (strName == "SPORK_12_RECONSIDER_BLOCKS") return SPORK_12_RECONSIDER_BLOCKS;
if (strName == "SPORK_16_INSTANTSEND_AUTOLOCKS") return SPORK_16_INSTANTSEND_AUTOLOCKS;
if (strName == "SPORK_17_QUORUM_DKG_ENABLED") return SPORK_17_QUORUM_DKG_ENABLED;
if (strName == "SPORK_18_QUORUM_DEBUG_ENABLED") return SPORK_18_QUORUM_DEBUG_ENABLED;

LogPrint("spork", "CSporkManager::GetSporkIDByName -- Unknown Spork name '%s'\n", strName);
return -1;
Expand All @@ -301,6 +303,7 @@ std::string CSporkManager::GetSporkNameByID(int nSporkID)
case SPORK_12_RECONSIDER_BLOCKS: return "SPORK_12_RECONSIDER_BLOCKS";
case SPORK_16_INSTANTSEND_AUTOLOCKS: return "SPORK_16_INSTANTSEND_AUTOLOCKS";
case SPORK_17_QUORUM_DKG_ENABLED: return "SPORK_17_QUORUM_DKG_ENABLED";
case SPORK_18_QUORUM_DEBUG_ENABLED: return "SPORK_18_QUORUM_DEBUG_ENABLED";
default:
LogPrint("spork", "CSporkManager::GetSporkNameByID -- Unknown Spork ID %d\n", nSporkID);
return "Unknown";
Expand Down
3 changes: 2 additions & 1 deletion src/spork.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ static const int SPORK_9_SUPERBLOCKS_ENABLED = 10008;
static const int SPORK_12_RECONSIDER_BLOCKS = 10011;
static const int SPORK_16_INSTANTSEND_AUTOLOCKS = 10015;
static const int SPORK_17_QUORUM_DKG_ENABLED = 10016;
static const int SPORK_18_QUORUM_DEBUG_ENABLED = 10017;

static const int SPORK_START = SPORK_2_INSTANTSEND_ENABLED;
static const int SPORK_END = SPORK_17_QUORUM_DKG_ENABLED;
static const int SPORK_END = SPORK_18_QUORUM_DEBUG_ENABLED;

extern std::map<int, int64_t> mapSporkDefaults;
extern CSporkManager sporkManager;
Expand Down

0 comments on commit 352edbd

Please sign in to comment.