mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
feat: reduce spamming logs with messages from v20 features (#5669)
## Issue being fixed or feature implemented There's too much spamming log items related to new v20 features: credit pool, asset locks, EHF manager, EHF Signaling for MN_RR. Some logs are still spamming after this PR but related code is not changed here https://github.com/dashpay/dash/pull/5658 ## What was done? - Removed some log items, tidy-up other. - logs that supposed to appear for each block are moved to new categories EHF and CREDITPOOL ## How Has This Been Tested? Run unit/functional tests, reviewed log output ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone
This commit is contained in:
parent
1b8d9ecc6b
commit
cae3fa5619
@ -124,7 +124,7 @@ bool CAssetUnlockPayload::VerifySig(const uint256& msgHash, gsl::not_null<const
|
||||
}
|
||||
|
||||
if (pindexTip->nHeight < requestedHeight || pindexTip->nHeight >= getHeightToExpiry()) {
|
||||
LogPrintf("Asset unlock tx %d with requested height %d could not be accepted on height: %d\n",
|
||||
LogPrint(BCLog::CREDITPOOL, "Asset unlock tx %d with requested height %d could not be accepted on height: %d\n",
|
||||
index, requestedHeight, pindexTip->nHeight);
|
||||
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-assetunlock-too-late");
|
||||
}
|
||||
|
@ -183,7 +183,8 @@ CCreditPool CCreditPoolManager::ConstructCreditPool(const CBlockIndex* const blo
|
||||
assert(currentLimit >= 0);
|
||||
|
||||
if (currentLimit > 0 || latelyUnlocked > 0 || locked > 0) {
|
||||
LogPrintf("CCreditPoolManager: asset unlock limits on height: %d locked: %d.%08d limit: %d.%08d previous: %d.%08d\n", block_index->nHeight, locked / COIN, locked % COIN,
|
||||
LogPrint(BCLog::CREDITPOOL, "CCreditPoolManager: asset unlock limits on height: %d locked: %d.%08d limit: %d.%08d previous: %d.%08d\n",
|
||||
block_index->nHeight, locked / COIN, locked % COIN,
|
||||
currentLimit / COIN, currentLimit % COIN,
|
||||
latelyUnlocked / COIN, latelyUnlocked % COIN);
|
||||
}
|
||||
@ -296,7 +297,7 @@ std::optional<CCreditPoolDiff> GetCreditPoolDiffForBlock(const CBlock& block, co
|
||||
{
|
||||
try {
|
||||
const CCreditPool creditPool = creditPoolManager->GetCreditPool(pindexPrev, consensusParams);
|
||||
LogPrintf("%s: CCreditPool is %s\n", __func__, creditPool.ToString());
|
||||
LogPrint(BCLog::CREDITPOOL, "%s: CCreditPool is %s\n", __func__, creditPool.ToString());
|
||||
CCreditPoolDiff creditPoolDiff(creditPool, pindexPrev, consensusParams, blockSubsidy);
|
||||
for (size_t i = 1; i < block.vtx.size(); ++i) {
|
||||
const auto& tx = *block.vtx[i];
|
||||
|
@ -189,6 +189,7 @@ bool CMNHFManager::ProcessBlock(const CBlock& block, const CBlockIndex* const pi
|
||||
if (!fJustCheck) {
|
||||
AddToCache(signals, pindex);
|
||||
}
|
||||
LogPrint(BCLog::EHF, "CMNHFManager::ProcessBlock: no new signals; number of known signals: %d\n", signals.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -232,7 +233,7 @@ bool CMNHFManager::UndoBlock(const CBlock& block, const CBlockIndex* const pinde
|
||||
std::vector<uint8_t> excluded_signals;
|
||||
BlockValidationState state;
|
||||
if (!extractSignals(block, pindex, excluded_signals, state)) {
|
||||
LogPrintf("%s: failed to extract signals\n", __func__);
|
||||
LogPrintf("CMNHFManager::%s: failed to extract signals\n", __func__);
|
||||
return false;
|
||||
}
|
||||
if (excluded_signals.empty()) {
|
||||
@ -284,20 +285,17 @@ CMNHFManager::Signals CMNHFManager::GetFromCache(const CBlockIndex* const pindex
|
||||
{
|
||||
LOCK(cs_cache);
|
||||
if (mnhfCache.get(blockHash, signals)) {
|
||||
LogPrintf("CMNHFManager::GetFromCache: mnhf get for block %s from cache: %lld signals\n", pindex->GetBlockHash().ToString(), signals.size());
|
||||
return signals;
|
||||
}
|
||||
}
|
||||
if (VersionBitsState(pindex->pprev, Params().GetConsensus(), Consensus::DEPLOYMENT_V20, versionbitscache) != ThresholdState::ACTIVE) {
|
||||
LOCK(cs_cache);
|
||||
mnhfCache.insert(blockHash, {});
|
||||
LogPrintf("CMNHFManager::GetFromCache: mnhf feature is disabled: return empty for block %s\n", pindex->GetBlockHash().ToString());
|
||||
return {};
|
||||
}
|
||||
if (!m_evoDb.Read(std::make_pair(DB_SIGNALS, blockHash), signals)) {
|
||||
LogPrintf("CMNHFManager::GetFromCache: failure: can't read MnEHF signals from db for %s\n", pindex->GetBlockHash().ToString());
|
||||
}
|
||||
LogPrintf("CMNHFManager::GetFromCache: mnhf for block %s read from evo: %lld\n", pindex->GetBlockHash().ToString(), signals.size());
|
||||
LOCK(cs_cache);
|
||||
mnhfCache.insert(blockHash, signals);
|
||||
return signals;
|
||||
@ -308,7 +306,6 @@ void CMNHFManager::AddToCache(const Signals& signals, const CBlockIndex* const p
|
||||
const uint256& blockHash = pindex->GetBlockHash();
|
||||
{
|
||||
LOCK(cs_cache);
|
||||
LogPrintf("CMNHFManager::AddToCache: mnhf for block %s add to cache: %lld\n", pindex->GetBlockHash().ToString(), signals.size());
|
||||
mnhfCache.insert(blockHash, signals);
|
||||
}
|
||||
m_evoDb.Write(std::make_pair(DB_SIGNALS, blockHash), signals);
|
||||
|
@ -149,7 +149,7 @@ bool ProcessSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex, CM
|
||||
|
||||
const CCreditPool creditPool = creditPoolManager->GetCreditPool(pindex->pprev, consensusParams);
|
||||
if (llmq::utils::IsV20Active(pindex->pprev)) {
|
||||
LogPrintf("%s: CCreditPool is %s\n", __func__, creditPool.ToString());
|
||||
LogPrint(BCLog::CREDITPOOL, "%s: CCreditPool is %s\n", __func__, creditPool.ToString());
|
||||
}
|
||||
|
||||
for (const auto& ptr_tx : block.vtx) {
|
||||
|
@ -62,8 +62,6 @@ void CEHFSignalsHandler::trySignEHFSignal(int bit, const CBlockIndex* const pind
|
||||
mnhfPayload.signal.versionBit = bit;
|
||||
const uint256 requestId = mnhfPayload.GetRequestId();
|
||||
|
||||
LogPrintf("CEHFSignalsHandler::trySignEHFSignal: bit=%d at height=%d id=%s\n", bit, pindex->nHeight, requestId.ToString());
|
||||
|
||||
const Consensus::LLMQType& llmqType = Params().GetConsensus().llmqTypeMnhf;
|
||||
const auto& llmq_params_opt = llmq::GetLLMQParams(llmqType);
|
||||
if (!llmq_params_opt.has_value()) {
|
||||
@ -73,6 +71,7 @@ void CEHFSignalsHandler::trySignEHFSignal(int bit, const CBlockIndex* const pind
|
||||
LOCK(cs);
|
||||
ids.insert(requestId);
|
||||
|
||||
LogPrint(BCLog::EHF, "CEHFSignalsHandler::trySignEHFSignal: already signed bit=%d at height=%d id=%s\n", bit, pindex->nHeight, requestId.ToString());
|
||||
// no need to sign same message one more time
|
||||
return;
|
||||
}
|
||||
@ -83,6 +82,7 @@ void CEHFSignalsHandler::trySignEHFSignal(int bit, const CBlockIndex* const pind
|
||||
return;
|
||||
}
|
||||
|
||||
LogPrint(BCLog::EHF, "CEHFSignalsHandler::trySignEHFSignal: bit=%d at height=%d id=%s\n", bit, pindex->nHeight, requestId.ToString());
|
||||
mnhfPayload.signal.quorumHash = quorum->qc->quorumHash;
|
||||
const uint256 msgHash = mnhfPayload.PrepareTx().GetHash();
|
||||
|
||||
@ -113,10 +113,10 @@ void CEHFSignalsHandler::HandleNewRecoveredSig(const CRecoveredSig& recoveredSig
|
||||
mnhfPayload.signal.versionBit = Params().GetConsensus().vDeployments[Consensus::DEPLOYMENT_MN_RR].bit;
|
||||
|
||||
const uint256 expectedId = mnhfPayload.GetRequestId();
|
||||
LogPrintf("CEHFSignalsHandler::HandleNewRecoveredSig expecting ID=%s received=%s\n", expectedId.ToString(), recoveredSig.getId().ToString());
|
||||
LogPrint(BCLog::EHF, "CEHFSignalsHandler::HandleNewRecoveredSig expecting ID=%s received=%s\n", expectedId.ToString(), recoveredSig.getId().ToString());
|
||||
if (recoveredSig.getId() != mnhfPayload.GetRequestId()) {
|
||||
// there's nothing interesting for CEHFSignalsHandler
|
||||
LogPrintf("CEHFSignalsHandler::HandleNewRecoveredSig id is known but it's not MN_RR, expected: %s\n", mnhfPayload.GetRequestId().ToString());
|
||||
LogPrint(BCLog::EHF, "CEHFSignalsHandler::HandleNewRecoveredSig id is known but it's not MN_RR, expected: %s\n", mnhfPayload.GetRequestId().ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -71,9 +71,12 @@ namespace BCLog {
|
||||
COINJOIN = ((uint64_t)1 << 41),
|
||||
SPORK = ((uint64_t)1 << 42),
|
||||
NETCONN = ((uint64_t)1 << 43),
|
||||
EHF = ((uint64_t)1 << 44),
|
||||
CREDITPOOL = ((uint64_t)1 << 45),
|
||||
|
||||
DASH = CHAINLOCKS | GOBJECT | INSTANTSEND | LLMQ | LLMQ_DKG
|
||||
| LLMQ_SIGS | MNPAYMENTS | MNSYNC | COINJOIN | SPORK | NETCONN,
|
||||
| LLMQ_SIGS | MNPAYMENTS | MNSYNC | COINJOIN | SPORK | NETCONN
|
||||
| EHF | CREDITPOOL,
|
||||
|
||||
NET_NETCONN = NET | NETCONN, // use this to have something logged in NET and NETCONN as well
|
||||
//End Dash
|
||||
|
@ -403,7 +403,6 @@ void BlockAssembler::addPackageTxs(int &nPackagesSelected, int &nDescendantsUpda
|
||||
std::optional<CCreditPoolDiff> creditPoolDiff;
|
||||
if (llmq::utils::IsV20Active(pindexPrev)) {
|
||||
CCreditPool creditPool = creditPoolManager->GetCreditPool(pindexPrev, chainparams.GetConsensus());
|
||||
LogPrintf("%s: CCreditPool is %s\n", __func__, creditPool.ToString());
|
||||
creditPoolDiff.emplace(std::move(creditPool), pindexPrev, chainparams.GetConsensus(), 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user