Skip to content

Commit fb87a5a

Browse files
Merge #6800: fix: Various log improvements
434434b fix: change connection related logs category from `net` to `net`+`netconn` (UdjinM6) 7839b59 fix: make bemchmark logs for `ProcessBlock`-s more explpicit (UdjinM6) 3cdf6d7 fix: adjust error message in `RemoveMN()` (UdjinM6) a55c35c feat: more logging in `CMNPaymentsProcessor::IsTransactionValid()` (UdjinM6) ad0c2b7 feat: improve logs in `PoSePunish()` (UdjinM6) Pull request description: ## Issue being fixed or feature implemented Pls see individual commits ## What was done? ## How Has This Been Tested? Check logs ## Breaking Changes n/a ## Checklist: - [ ] 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 - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: knst: utACK 434434b PastaPastaPasta: utACK 434434b Tree-SHA512: 491925bbe00b18e56abf23dda3e0287242c4e098947651c4ad5a2e2d1c990c2732f41ac051c866cf9871852210b9a1c1cf194a0a0c3c819cfacaf02449ed907b
2 parents dae1f19 + 434434b commit fb87a5a

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

src/evo/deterministicmns.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -311,16 +311,14 @@ void CDeterministicMNList::PoSePunish(const uint256& proTxHash, int penalty, boo
311311
newState->nPoSePenalty += penalty;
312312
newState->nPoSePenalty = std::min(maxPenalty, newState->nPoSePenalty);
313313

314-
if (debugLogs && dmn->pdmnState->nPoSePenalty != maxPenalty) {
315-
LogPrintf("CDeterministicMNList::%s -- punished MN %s, penalty %d->%d (max=%d)\n",
316-
__func__, proTxHash.ToString(), dmn->pdmnState->nPoSePenalty, newState->nPoSePenalty, maxPenalty);
317-
}
318-
319-
if (newState->nPoSePenalty >= maxPenalty && !newState->IsBanned()) {
320-
newState->BanIfNotBanned(nHeight);
314+
if (!dmn->pdmnState->IsBanned()) {
315+
if (newState->nPoSePenalty >= maxPenalty) {
316+
newState->BanIfNotBanned(nHeight);
317+
}
321318
if (debugLogs) {
322-
LogPrintf("CDeterministicMNList::%s -- banned MN %s at height %d\n",
323-
__func__, proTxHash.ToString(), nHeight);
319+
LogPrintf("CDeterministicMNList::%s -- %s MN %s at height %d, penalty %d->%d (max=%d)\n", __func__,
320+
newState->IsBanned() ? "banned" : "punished", proTxHash.ToString(), nHeight,
321+
dmn->pdmnState->nPoSePenalty, newState->nPoSePenalty, maxPenalty);
324322
}
325323
}
326324
UpdateMN(proTxHash, newState);
@@ -607,7 +605,7 @@ void CDeterministicMNList::RemoveMN(const uint256& proTxHash)
607605
if (dmn->nType == MnType::Evo) {
608606
if (dmn->pdmnState->platformNodeID != uint160() && !DeleteUniqueProperty(*dmn, dmn->pdmnState->platformNodeID)) {
609607
mnUniquePropertyMap = mnUniquePropertyMapSaved;
610-
throw(std::runtime_error(strprintf("%s: Can't delete a masternode %s with a duplicate platformNodeID=%s", __func__,
608+
throw(std::runtime_error(strprintf("%s: Can't delete a masternode %s with a platformNodeID=%s", __func__,
611609
dmn->proTxHash.ToString(), dmn->pdmnState->platformNodeID.ToString())));
612610
}
613611
}

src/evo/specialtxman.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ bool CSpecialTxProcessor::ProcessSpecialTxsInBlock(const CBlock& block, const CB
584584

585585
int64_t nTime5 = GetTimeMicros();
586586
nTimeQuorum += nTime5 - nTime4;
587-
LogPrint(BCLog::BENCHMARK, " - m_qblockman: %.2fms [%.2fs]\n", 0.001 * (nTime5 - nTime4),
587+
LogPrint(BCLog::BENCHMARK, " - m_qblockman.ProcessBlock: %.2fms [%.2fs]\n", 0.001 * (nTime5 - nTime4),
588588
nTimeQuorum * 0.000001);
589589

590590
CDeterministicMNList mn_list;
@@ -603,7 +603,8 @@ bool CSpecialTxProcessor::ProcessSpecialTxsInBlock(const CBlock& block, const CB
603603

604604
int64_t nTime6 = GetTimeMicros();
605605
nTimeDMN += nTime6 - nTime5;
606-
LogPrint(BCLog::BENCHMARK, " - m_dmnman: %.2fms [%.2fs]\n", 0.001 * (nTime6 - nTime5), nTimeDMN * 0.000001);
606+
LogPrint(BCLog::BENCHMARK, " - m_dmnman.ProcessBlock: %.2fms [%.2fs]\n", 0.001 * (nTime6 - nTime5),
607+
nTimeDMN * 0.000001);
607608

608609
if (opt_cbTx.has_value()) {
609610
uint256 calculatedMerkleRootMNL;
@@ -657,7 +658,8 @@ bool CSpecialTxProcessor::ProcessSpecialTxsInBlock(const CBlock& block, const CB
657658

658659
int64_t nTime8 = GetTimeMicros();
659660
nTimeMnehf += nTime8 - nTime7;
660-
LogPrint(BCLog::BENCHMARK, " - m_mnhfman: %.2fms [%.2fs]\n", 0.001 * (nTime8 - nTime7), nTimeMnehf * 0.000001);
661+
LogPrint(BCLog::BENCHMARK, " - m_mnhfman.ProcessBlock: %.2fms [%.2fs]\n", 0.001 * (nTime8 - nTime7),
662+
nTimeMnehf * 0.000001);
661663

662664
if (DeploymentActiveAfter(pindex, m_consensus_params, Consensus::DEPLOYMENT_V19) && bls::bls_legacy_scheme.load()) {
663665
// NOTE: The block next to the activation is the one that is using new rules.

src/masternode/payments.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ CAmount PlatformShare(const CAmount reward)
127127
if (!found) {
128128
std::string str_payout;
129129
if (CTxDestination dest; ExtractDestination(txout.scriptPubKey, dest)) {
130-
str_payout = EncodeDestination(dest);
130+
str_payout = "address=" + EncodeDestination(dest);
131131
} else {
132-
str_payout = HexStr(txout.scriptPubKey);
132+
str_payout = "scriptPubKey=" + HexStr(txout.scriptPubKey);
133133
}
134-
LogPrintf("CMNPaymentsProcessor::%s -- ERROR! Failed to find expected payee %s in block at height %s\n",
135-
__func__, str_payout, nBlockHeight);
134+
LogPrintf("CMNPaymentsProcessor::%s -- ERROR! Failed to find expected payee %s amount=%lld height=%d\n",
135+
__func__, str_payout, txout.nValue, nBlockHeight);
136136
return false;
137137
}
138138
}

src/net.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,15 +1945,15 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock,
19451945
bool banned = m_banman && m_banman->IsBanned(addr);
19461946
if (!NetPermissions::HasFlag(permission_flags, NetPermissionFlags::NoBan) && banned)
19471947
{
1948-
LogPrint(BCLog::NET, "%s (banned)\n", strDropped);
1948+
LogPrint(BCLog::NET_NETCONN, "%s (banned)\n", strDropped);
19491949
return;
19501950
}
19511951

19521952
// Only accept connections from discouraged peers if our inbound slots aren't (almost) full.
19531953
bool discouraged = m_banman && m_banman->IsDiscouraged(addr);
19541954
if (!NetPermissions::HasFlag(permission_flags, NetPermissionFlags::NoBan) && nInbound + 1 >= nMaxInbound && discouraged)
19551955
{
1956-
LogPrint(BCLog::NET, "connection from %s dropped (discouraged)\n", addr.ToStringAddrPort());
1956+
LogPrint(BCLog::NET_NETCONN, "connection from %s dropped (discouraged)\n", addr.ToStringAddrPort());
19571957
return;
19581958
}
19591959

@@ -1966,15 +1966,15 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock,
19661966
{
19671967
if (!AttemptToEvictConnection()) {
19681968
// No connection to evict, disconnect the new connection
1969-
LogPrint(BCLog::NET, "failed to find an eviction candidate - connection dropped (full)\n");
1969+
LogPrint(BCLog::NET_NETCONN, "failed to find an eviction candidate - connection dropped (full)\n");
19701970
return;
19711971
}
19721972
nInbound--;
19731973
}
19741974

19751975
// don't accept incoming connections until blockchain is synced
19761976
if (fMasternodeMode && !mn_sync.IsBlockchainSynced()) {
1977-
LogPrint(BCLog::NET, "AcceptConnection -- blockchain is not synced yet, skipping inbound connection attempt\n");
1977+
LogPrint(BCLog::NET_NETCONN, "AcceptConnection -- blockchain is not synced yet, skipping inbound connection attempt\n");
19781978
return;
19791979
}
19801980

@@ -2092,7 +2092,7 @@ void CConnman::DisconnectNodes()
20922092
// Disconnect any connected nodes
20932093
for (CNode* pnode : m_nodes) {
20942094
if (!pnode->fDisconnect) {
2095-
LogPrint(BCLog::NET, "Network not active, dropping peer=%d\n", pnode->GetId());
2095+
LogPrint(BCLog::NET_NETCONN, "Network not active, dropping peer=%d\n", pnode->GetId());
20962096
pnode->fDisconnect = true;
20972097
}
20982098
}

0 commit comments

Comments
 (0)