@@ -1059,23 +1059,22 @@ unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans)
1059
1059
* Increment peer's misbehavior score. If the new value >= DISCOURAGEMENT_THRESHOLD, mark the node
1060
1060
* to be discouraged, meaning the peer might be disconnected and added to the discouragement filter.
1061
1061
*/
1062
- void Misbehaving (NodeId pnode, int howmuch, const std::string& message) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
1062
+ void Misbehaving (const NodeId pnode, const int howmuch, const std::string& message) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
1063
1063
{
1064
- if (howmuch == 0 )
1065
- return ;
1064
+ assert (howmuch > 0 );
1066
1065
1067
- CNodeState *state = State (pnode);
1068
- if (state == nullptr )
1069
- return ;
1066
+ CNodeState* const state = State (pnode);
1067
+ if (state == nullptr ) return ;
1070
1068
1071
1069
state->nMisbehavior += howmuch;
1072
- std::string message_prefixed = message.empty () ? " " : (" : " + message);
1070
+ const std::string message_prefixed = message.empty () ? " " : (" : " + message);
1073
1071
if (state->nMisbehavior >= DISCOURAGEMENT_THRESHOLD && state->nMisbehavior - howmuch < DISCOURAGEMENT_THRESHOLD)
1074
1072
{
1075
- LogPrint (BCLog::NET, " %s: %s peer=%d (%d -> %d) DISCOURAGE THRESHOLD EXCEEDED%s\n " , __func__, state-> name , pnode, state->nMisbehavior - howmuch, state->nMisbehavior , message_prefixed);
1073
+ LogPrint (BCLog::NET, " Misbehaving: peer=%d (%d -> %d) DISCOURAGE THRESHOLD EXCEEDED%s\n " , pnode, state->nMisbehavior - howmuch, state->nMisbehavior , message_prefixed);
1076
1074
state->m_should_discourage = true ;
1077
- } else
1078
- LogPrint (BCLog::NET, " %s: %s peer=%d (%d -> %d)%s\n " , __func__, state->name , pnode, state->nMisbehavior -howmuch, state->nMisbehavior , message_prefixed);
1075
+ } else {
1076
+ LogPrint (BCLog::NET, " Misbehaving: peer=%d (%d -> %d)%s\n " , pnode, state->nMisbehavior - howmuch, state->nMisbehavior , message_prefixed);
1077
+ }
1079
1078
}
1080
1079
1081
1080
/* *
0 commit comments