mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
spork debug log: (#1016)
- add "spork" debug category - move "seen" and "unknown" to new "spork" debug category to reduce log spam - new/updated/seen messages should not overlap
This commit is contained in:
parent
d843596304
commit
7f687fd696
@ -517,7 +517,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||||||
strUsage += HelpMessageOpt("-limitdescendantsize=<n>", strprintf("Do not accept transactions if any ancestor would have more than <n> kilobytes of in-mempool descendants (default: %u).", DEFAULT_DESCENDANT_SIZE_LIMIT));
|
strUsage += HelpMessageOpt("-limitdescendantsize=<n>", strprintf("Do not accept transactions if any ancestor would have more than <n> kilobytes of in-mempool descendants (default: %u).", DEFAULT_DESCENDANT_SIZE_LIMIT));
|
||||||
}
|
}
|
||||||
string debugCategories = "addrman, alert, bench, coindb, db, lock, rand, rpc, selectcoins, mempool, mempoolrej, net, proxy, prune, http, libevent, tor, zmq, "
|
string debugCategories = "addrman, alert, bench, coindb, db, lock, rand, rpc, selectcoins, mempool, mempoolrej, net, proxy, prune, http, libevent, tor, zmq, "
|
||||||
"dash (or specifically: privatesend, instantsend, masternode, keepass, mnpayments, gobject)"; // Don't translate these and qt below
|
"dash (or specifically: privatesend, instantsend, masternode, spork, keepass, mnpayments, gobject)"; // Don't translate these and qt below
|
||||||
if (mode == HMM_BITCOIN_QT)
|
if (mode == HMM_BITCOIN_QT)
|
||||||
debugCategories += ", qt";
|
debugCategories += ", qt";
|
||||||
strUsage += HelpMessageOpt("-debug=<category>", strprintf(_("Output debugging information (default: %u, supplying <category> is optional)"), 0) + ". " +
|
strUsage += HelpMessageOpt("-debug=<category>", strprintf(_("Output debugging information (default: %u, supplying <category> is optional)"), 0) + ". " +
|
||||||
|
@ -121,7 +121,7 @@ UniValue debug(const UniValue& params, bool fHelp)
|
|||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"debug ( 0|1|addrman|alert|bench|coindb|db|lock|rand|rpc|selectcoins|mempool"
|
"debug ( 0|1|addrman|alert|bench|coindb|db|lock|rand|rpc|selectcoins|mempool"
|
||||||
"|mempoolrej|net|proxy|prune|http|libevent|tor|zmq|"
|
"|mempoolrej|net|proxy|prune|http|libevent|tor|zmq|"
|
||||||
"dash|privatesend|instantsend|masternode|keepass|mnpayments|gobject )\n"
|
"dash|privatesend|instantsend|masternode|spork|keepass|mnpayments|gobject )\n"
|
||||||
"Change debug category on the fly. Specify single category or use comma to specify many.\n"
|
"Change debug category on the fly. Specify single category or use comma to specify many.\n"
|
||||||
"\nExamples:\n"
|
"\nExamples:\n"
|
||||||
+ HelpExampleCli("debug", "dash")
|
+ HelpExampleCli("debug", "dash")
|
||||||
|
@ -21,25 +21,29 @@ void CSporkManager::ProcessSpork(CNode* pfrom, std::string& strCommand, CDataStr
|
|||||||
|
|
||||||
if (strCommand == NetMsgType::SPORK) {
|
if (strCommand == NetMsgType::SPORK) {
|
||||||
|
|
||||||
// LogPrintf("CSporkManager::ProcessSpork\n");
|
|
||||||
CDataStream vMsg(vRecv);
|
CDataStream vMsg(vRecv);
|
||||||
CSporkMessage spork;
|
CSporkMessage spork;
|
||||||
vRecv >> spork;
|
vRecv >> spork;
|
||||||
|
|
||||||
LOCK(cs_main);
|
|
||||||
if(chainActive.Tip() == NULL) return;
|
|
||||||
|
|
||||||
uint256 hash = spork.GetHash();
|
uint256 hash = spork.GetHash();
|
||||||
if(mapSporksActive.count(spork.nSporkID)) {
|
|
||||||
if (mapSporksActive[spork.nSporkID].nTimeSigned >= spork.nTimeSigned) {
|
std::string strLogMsg;
|
||||||
if(fDebug) LogPrintf("CSporkManager::ProcessSpork -- seen %s block %d\n", hash.ToString(), chainActive.Tip()->nHeight);
|
{
|
||||||
return;
|
LOCK(cs_main);
|
||||||
} else {
|
if(!chainActive.Tip()) return;
|
||||||
if(fDebug) LogPrintf("CSporkManager::ProcessSpork -- got updated spork %s block %d\n", hash.ToString(), chainActive.Tip()->nHeight);
|
strLogMsg = strprintf("SPORK -- hash: %s id: %d value: %10d bestHeight: %d peer=%d", hash.ToString(), spork.nSporkID, spork.nValue, chainActive.Height(), pfrom->id);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LogPrintf("spork -- hash: %s id: %d value: %10d bestHeight: %d new\n", hash.ToString(), spork.nSporkID, spork.nValue, chainActive.Tip()->nHeight);
|
if(mapSporksActive.count(spork.nSporkID)) {
|
||||||
|
if (mapSporksActive[spork.nSporkID].nTimeSigned >= spork.nTimeSigned) {
|
||||||
|
LogPrint("spork", "%s seen\n", strLogMsg);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
LogPrintf("%s updated\n", strLogMsg);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LogPrintf("%s new\n", strLogMsg);
|
||||||
|
}
|
||||||
|
|
||||||
if(!spork.CheckSignature()) {
|
if(!spork.CheckSignature()) {
|
||||||
LogPrintf("CSporkManager::ProcessSpork -- invalid signature\n");
|
LogPrintf("CSporkManager::ProcessSpork -- invalid signature\n");
|
||||||
@ -109,7 +113,7 @@ bool CSporkManager::IsSporkActive(int nSporkID)
|
|||||||
case SPORK_12_RECONSIDER_BLOCKS: r = SPORK_12_RECONSIDER_BLOCKS_DEFAULT; break;
|
case SPORK_12_RECONSIDER_BLOCKS: r = SPORK_12_RECONSIDER_BLOCKS_DEFAULT; break;
|
||||||
case SPORK_13_OLD_SUPERBLOCK_FLAG: r = SPORK_13_OLD_SUPERBLOCK_FLAG_DEFAULT; break;
|
case SPORK_13_OLD_SUPERBLOCK_FLAG: r = SPORK_13_OLD_SUPERBLOCK_FLAG_DEFAULT; break;
|
||||||
default:
|
default:
|
||||||
LogPrintf("CSporkManager::IsSporkActive -- Unknown Spork %d\n", nSporkID);
|
LogPrint("spork", "CSporkManager::IsSporkActive -- Unknown Spork ID %d\n", nSporkID);
|
||||||
r = 4070908800; // 2099-1-1 i.e. off by default
|
r = 4070908800; // 2099-1-1 i.e. off by default
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -134,7 +138,7 @@ int64_t CSporkManager::GetSporkValue(int nSporkID)
|
|||||||
case SPORK_12_RECONSIDER_BLOCKS: return SPORK_12_RECONSIDER_BLOCKS_DEFAULT;
|
case SPORK_12_RECONSIDER_BLOCKS: return SPORK_12_RECONSIDER_BLOCKS_DEFAULT;
|
||||||
case SPORK_13_OLD_SUPERBLOCK_FLAG: return SPORK_13_OLD_SUPERBLOCK_FLAG_DEFAULT;
|
case SPORK_13_OLD_SUPERBLOCK_FLAG: return SPORK_13_OLD_SUPERBLOCK_FLAG_DEFAULT;
|
||||||
default:
|
default:
|
||||||
LogPrintf("CSporkManager::GetSporkValue -- Unknown Spork ID %d\n", nSporkID);
|
LogPrint("spork", "CSporkManager::GetSporkValue -- Unknown Spork ID %d\n", nSporkID);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +155,7 @@ int CSporkManager::GetSporkIDByName(std::string strName)
|
|||||||
if (strName == "SPORK_12_RECONSIDER_BLOCKS") return SPORK_12_RECONSIDER_BLOCKS;
|
if (strName == "SPORK_12_RECONSIDER_BLOCKS") return SPORK_12_RECONSIDER_BLOCKS;
|
||||||
if (strName == "SPORK_13_OLD_SUPERBLOCK_FLAG") return SPORK_13_OLD_SUPERBLOCK_FLAG;
|
if (strName == "SPORK_13_OLD_SUPERBLOCK_FLAG") return SPORK_13_OLD_SUPERBLOCK_FLAG;
|
||||||
|
|
||||||
LogPrintf("CSporkManager::GetSporkIDByName -- Unknown Spork name '%s'\n", strName);
|
LogPrint("spork", "CSporkManager::GetSporkIDByName -- Unknown Spork name '%s'\n", strName);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +171,7 @@ std::string CSporkManager::GetSporkNameByID(int nSporkID)
|
|||||||
case SPORK_12_RECONSIDER_BLOCKS: return "SPORK_12_RECONSIDER_BLOCKS";
|
case SPORK_12_RECONSIDER_BLOCKS: return "SPORK_12_RECONSIDER_BLOCKS";
|
||||||
case SPORK_13_OLD_SUPERBLOCK_FLAG: return "SPORK_13_OLD_SUPERBLOCK_FLAG";
|
case SPORK_13_OLD_SUPERBLOCK_FLAG: return "SPORK_13_OLD_SUPERBLOCK_FLAG";
|
||||||
default:
|
default:
|
||||||
LogPrintf("CSporkManager::GetSporkNameByID -- Unknown Spork ID %d\n", nSporkID);
|
LogPrint("spork", "CSporkManager::GetSporkNameByID -- Unknown Spork ID %d\n", nSporkID);
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,6 +278,7 @@ bool LogAcceptCategory(const char* category)
|
|||||||
ptrCategory->insert(string("privatesend"));
|
ptrCategory->insert(string("privatesend"));
|
||||||
ptrCategory->insert(string("instantsend"));
|
ptrCategory->insert(string("instantsend"));
|
||||||
ptrCategory->insert(string("masternode"));
|
ptrCategory->insert(string("masternode"));
|
||||||
|
ptrCategory->insert(string("spork"));
|
||||||
ptrCategory->insert(string("keepass"));
|
ptrCategory->insert(string("keepass"));
|
||||||
ptrCategory->insert(string("mnpayments"));
|
ptrCategory->insert(string("mnpayments"));
|
||||||
ptrCategory->insert(string("gobject"));
|
ptrCategory->insert(string("gobject"));
|
||||||
|
Loading…
Reference in New Issue
Block a user