Skip to content
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
18 changes: 8 additions & 10 deletions src/evo/deterministicmns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,16 +311,14 @@ void CDeterministicMNList::PoSePunish(const uint256& proTxHash, int penalty, boo
newState->nPoSePenalty += penalty;
newState->nPoSePenalty = std::min(maxPenalty, newState->nPoSePenalty);

if (debugLogs && dmn->pdmnState->nPoSePenalty != maxPenalty) {
LogPrintf("CDeterministicMNList::%s -- punished MN %s, penalty %d->%d (max=%d)\n",
__func__, proTxHash.ToString(), dmn->pdmnState->nPoSePenalty, newState->nPoSePenalty, maxPenalty);
}

if (newState->nPoSePenalty >= maxPenalty && !newState->IsBanned()) {
newState->BanIfNotBanned(nHeight);
if (!dmn->pdmnState->IsBanned()) {
if (newState->nPoSePenalty >= maxPenalty) {
newState->BanIfNotBanned(nHeight);
}
if (debugLogs) {
LogPrintf("CDeterministicMNList::%s -- banned MN %s at height %d\n",
__func__, proTxHash.ToString(), nHeight);
LogPrintf("CDeterministicMNList::%s -- %s MN %s at height %d, penalty %d->%d (max=%d)\n", __func__,
newState->IsBanned() ? "banned" : "punished", proTxHash.ToString(), nHeight,
dmn->pdmnState->nPoSePenalty, newState->nPoSePenalty, maxPenalty);
}
}
UpdateMN(proTxHash, newState);
Expand Down Expand Up @@ -607,7 +605,7 @@ void CDeterministicMNList::RemoveMN(const uint256& proTxHash)
if (dmn->nType == MnType::Evo) {
if (dmn->pdmnState->platformNodeID != uint160() && !DeleteUniqueProperty(*dmn, dmn->pdmnState->platformNodeID)) {
mnUniquePropertyMap = mnUniquePropertyMapSaved;
throw(std::runtime_error(strprintf("%s: Can't delete a masternode %s with a duplicate platformNodeID=%s", __func__,
throw(std::runtime_error(strprintf("%s: Can't delete a masternode %s with a platformNodeID=%s", __func__,
dmn->proTxHash.ToString(), dmn->pdmnState->platformNodeID.ToString())));
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/evo/specialtxman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ bool CSpecialTxProcessor::ProcessSpecialTxsInBlock(const CBlock& block, const CB

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

CDeterministicMNList mn_list;
Expand All @@ -601,7 +601,8 @@ bool CSpecialTxProcessor::ProcessSpecialTxsInBlock(const CBlock& block, const CB

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

if (opt_cbTx.has_value()) {
uint256 calculatedMerkleRootMNL;
Expand Down Expand Up @@ -655,7 +656,8 @@ bool CSpecialTxProcessor::ProcessSpecialTxsInBlock(const CBlock& block, const CB

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

if (DeploymentActiveAfter(pindex, m_consensus_params, Consensus::DEPLOYMENT_V19) && bls::bls_legacy_scheme.load()) {
// NOTE: The block next to the activation is the one that is using new rules.
Expand Down
8 changes: 4 additions & 4 deletions src/masternode/payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ CAmount PlatformShare(const CAmount reward)
if (!found) {
std::string str_payout;
if (CTxDestination dest; ExtractDestination(txout.scriptPubKey, dest)) {
str_payout = EncodeDestination(dest);
str_payout = "address=" + EncodeDestination(dest);
} else {
str_payout = HexStr(txout.scriptPubKey);
str_payout = "scriptPubKey=" + HexStr(txout.scriptPubKey);
}
LogPrintf("CMNPaymentsProcessor::%s -- ERROR! Failed to find expected payee %s in block at height %s\n",
__func__, str_payout, nBlockHeight);
LogPrintf("CMNPaymentsProcessor::%s -- ERROR! Failed to find expected payee %s amount=%lld height=%d\n",
Copy link
Collaborator

@knst knst Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: coderabbit doesn't know what it says, you should not put here "%lld".

Consider using %lld instead of %d for the amount parameter to be more explicit about the 64-bit integer format, consistent with other logging in the codebase:

It is not true; tinyformat ignores wide of type specified here, see https://github.com/c42f/tinyformat/blob/master/tinyformat_test.cpp#L250-L256

    // Check that length modifiers are ignored

Because tinyformat uses template output '<<' to determine wideness of type

__func__, str_payout, txout.nValue, nBlockHeight);
return false;
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1945,15 +1945,15 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock,
bool banned = m_banman && m_banman->IsBanned(addr);
if (!NetPermissions::HasFlag(permission_flags, NetPermissionFlags::NoBan) && banned)
{
LogPrint(BCLog::NET, "%s (banned)\n", strDropped);
LogPrint(BCLog::NET_NETCONN, "%s (banned)\n", strDropped);
return;
}

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

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

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

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