Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 1,152 Lines • ▼ Show 20 Lines | void Misbehaving(NodeId pnode, int howmuch, const std::string &reason) | ||||
state->nMisbehavior += howmuch; | state->nMisbehavior += howmuch; | ||||
int banscore = gArgs.GetArg("-banscore", DEFAULT_BANSCORE_THRESHOLD); | int banscore = gArgs.GetArg("-banscore", DEFAULT_BANSCORE_THRESHOLD); | ||||
if (state->nMisbehavior >= banscore && | if (state->nMisbehavior >= banscore && | ||||
state->nMisbehavior - howmuch < banscore) { | state->nMisbehavior - howmuch < banscore) { | ||||
LogPrintf( | LogPrintf( | ||||
"%s: %s peer=%d (%d -> %d) reason: %s BAN THRESHOLD EXCEEDED\n", | "%s: %s peer=%d (%d -> %d) reason: %s BAN THRESHOLD EXCEEDED\n", | ||||
__func__, state->name, pnode, state->nMisbehavior - howmuch, | __func__, state->name, pnode, state->nMisbehavior - howmuch, | ||||
state->nMisbehavior, reason.c_str()); | state->nMisbehavior, reason); | ||||
state->fShouldBan = true; | state->fShouldBan = true; | ||||
} else { | } else { | ||||
LogPrintf("%s: %s peer=%d (%d -> %d) reason: %s\n", __func__, | LogPrintf("%s: %s peer=%d (%d -> %d) reason: %s\n", __func__, | ||||
state->name, pnode, state->nMisbehavior - howmuch, | state->name, pnode, state->nMisbehavior - howmuch, | ||||
state->nMisbehavior, reason.c_str()); | state->nMisbehavior, reason); | ||||
} | } | ||||
} | } | ||||
// overloaded variant of above to operate on CNode*s | // overloaded variant of above to operate on CNode*s | ||||
static void Misbehaving(CNode *node, int howmuch, const std::string &reason) | static void Misbehaving(CNode *node, int howmuch, const std::string &reason) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | ||||
Misbehaving(node->GetId(), howmuch, reason); | Misbehaving(node->GetId(), howmuch, reason); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,104 Lines • ▼ Show 20 Lines | if (strCommand == NetMsgType::VERSION) { | ||||
std::string remoteAddr; | std::string remoteAddr; | ||||
if (fLogIPs) { | if (fLogIPs) { | ||||
remoteAddr = ", peeraddr=" + pfrom->addr.ToString(); | remoteAddr = ", peeraddr=" + pfrom->addr.ToString(); | ||||
} | } | ||||
LogPrint(BCLog::NET, | LogPrint(BCLog::NET, | ||||
"receive version message: [%s] %s: version %d, blocks=%d, " | "receive version message: [%s] %s: version %d, blocks=%d, " | ||||
"us=%s, peer=%d%s\n", | "us=%s, peer=%d%s\n", | ||||
pfrom->addr.ToString().c_str(), cleanSubVer, pfrom->nVersion, | pfrom->addr.ToString(), cleanSubVer, pfrom->nVersion, | ||||
pfrom->nStartingHeight, addrMe.ToString(), pfrom->GetId(), | pfrom->nStartingHeight, addrMe.ToString(), pfrom->GetId(), | ||||
remoteAddr); | remoteAddr); | ||||
int64_t nTimeOffset = nTime - GetTime(); | int64_t nTimeOffset = nTime - GetTime(); | ||||
pfrom->nTimeOffset = nTimeOffset; | pfrom->nTimeOffset = nTimeOffset; | ||||
AddTimeData(pfrom->addr, nTimeOffset); | AddTimeData(pfrom->addr, nTimeOffset); | ||||
// If the peer is old enough to have the old alert system, send it the | // If the peer is old enough to have the old alert system, send it the | ||||
▲ Show 20 Lines • Show All 2,582 Lines • Show Last 20 Lines |