diff options
author | John Newbery <john@johnnewbery.com> | 2020-06-16 16:27:34 -0400 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2020-08-12 11:23:22 +0100 |
commit | 8e35bf59062b3a823182588e0bf809b3367c2be0 (patch) | |
tree | 07137095012ce1b833c1c5d468188d4a5c48ebb7 /src/net_processing.cpp | |
parent | 1f96d2e673a78220eebf3bbd15b121c51c4cd97b (diff) | |
download | bitcoin-8e35bf59062b3a823182588e0bf809b3367c2be0.tar.xz |
scripted-diff: rename misbehavior members
-BEGIN VERIFY SCRIPT-
sed -i 's/nMisbehavior/m_misbehavior_score/g' src/net_processing.cpp src/net_processing.h src/rpc/net.cpp src/qt/rpcconsole.cpp
-END VERIFY SCRIPT-
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 2edd57f458..07562679f7 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -482,7 +482,7 @@ struct Peer { /** Protects misbehavior data members */ Mutex m_misbehavior_mutex; /** Accumulated misbehavior score for this peer */ - int nMisbehavior GUARDED_BY(m_misbehavior_mutex){0}; + int m_misbehavior_score GUARDED_BY(m_misbehavior_mutex){0}; /** Whether this peer should be disconnected and marked as discouraged (unless it has the noban permission). */ bool m_should_discourage GUARDED_BY(m_misbehavior_mutex){false}; @@ -912,7 +912,7 @@ void PeerLogicValidation::FinalizeNode(NodeId nodeid, bool& fUpdateConnectionTim { PeerRef peer = GetPeerRef(nodeid); assert(peer != nullptr); - misbehavior = WITH_LOCK(peer->m_misbehavior_mutex, return peer->nMisbehavior); + misbehavior = WITH_LOCK(peer->m_misbehavior_mutex, return peer->m_misbehavior_score); LOCK(g_peer_mutex); g_peer_map.erase(nodeid); } @@ -967,7 +967,7 @@ bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) { PeerRef peer = GetPeerRef(nodeid); if (peer == nullptr) return false; - stats.nMisbehavior = WITH_LOCK(peer->m_misbehavior_mutex, return peer->nMisbehavior); + stats.m_misbehavior_score = WITH_LOCK(peer->m_misbehavior_mutex, return peer->m_misbehavior_score); return true; } @@ -1120,13 +1120,13 @@ void Misbehaving(const NodeId pnode, const int howmuch, const std::string& messa if (peer == nullptr) return; LOCK(peer->m_misbehavior_mutex); - peer->nMisbehavior += howmuch; + peer->m_misbehavior_score += howmuch; const std::string message_prefixed = message.empty() ? "" : (": " + message); - if (peer->nMisbehavior >= DISCOURAGEMENT_THRESHOLD && peer->nMisbehavior - howmuch < DISCOURAGEMENT_THRESHOLD) { - LogPrint(BCLog::NET, "Misbehaving: peer=%d (%d -> %d) DISCOURAGE THRESHOLD EXCEEDED%s\n", pnode, peer->nMisbehavior - howmuch, peer->nMisbehavior, message_prefixed); + if (peer->m_misbehavior_score >= DISCOURAGEMENT_THRESHOLD && peer->m_misbehavior_score - howmuch < DISCOURAGEMENT_THRESHOLD) { + LogPrint(BCLog::NET, "Misbehaving: peer=%d (%d -> %d) DISCOURAGE THRESHOLD EXCEEDED%s\n", pnode, peer->m_misbehavior_score - howmuch, peer->m_misbehavior_score, message_prefixed); peer->m_should_discourage = true; } else { - LogPrint(BCLog::NET, "Misbehaving: peer=%d (%d -> %d)%s\n", pnode, peer->nMisbehavior - howmuch, peer->nMisbehavior, message_prefixed); + LogPrint(BCLog::NET, "Misbehaving: peer=%d (%d -> %d)%s\n", pnode, peer->m_misbehavior_score - howmuch, peer->m_misbehavior_score, message_prefixed); } } |