Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 2,995 Lines • ▼ Show 20 Lines | if (strCommand == NetMsgType::TX) { | ||||
LogPrintf("Not relaying invalid transaction %s from " | LogPrintf("Not relaying invalid transaction %s from " | ||||
"whitelisted peer=%d (%s)\n", | "whitelisted peer=%d (%s)\n", | ||||
tx.GetId().ToString(), pfrom->GetId(), | tx.GetId().ToString(), pfrom->GetId(), | ||||
FormatStateMessage(state)); | FormatStateMessage(state)); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// If a tx has been detected by recentRejects, we will have reached | |||||
// this point and the tx will have been ignored. Because we haven't run | |||||
// the tx through AcceptToMemoryPool, we won't have computed a DoS | |||||
// score for it or determined exactly why we consider it invalid. | |||||
// | |||||
// This means we won't penalize any peer subsequently relaying a DoSy | |||||
// tx (even if we penalized the first peer who gave it to us) because | |||||
// we have to account for recentRejects showing false positives. In | |||||
// other words, we shouldn't penalize a peer if we aren't *sure* they | |||||
// submitted a DoSy tx. | |||||
// | |||||
// Note that recentRejects doesn't just record DoSy or invalid | |||||
// transactions, but any tx not accepted by the mempool, which may be | |||||
// due to node policy (vs. consensus). So we can't blanket penalize a | |||||
// peer simply for relaying a tx that our recentRejects has caught, | |||||
// regardless of false positives. | |||||
int nDoS = 0; | int nDoS = 0; | ||||
if (state.IsInvalid(nDoS)) { | if (state.IsInvalid(nDoS)) { | ||||
LogPrint(BCLog::MEMPOOLREJ, | LogPrint(BCLog::MEMPOOLREJ, | ||||
"%s from peer=%d was not accepted: %s\n", | "%s from peer=%d was not accepted: %s\n", | ||||
tx.GetHash().ToString(), pfrom->GetId(), | tx.GetHash().ToString(), pfrom->GetId(), | ||||
FormatStateMessage(state)); | FormatStateMessage(state)); | ||||
// Never send AcceptToMemoryPool's internal codes over P2P. | // Never send AcceptToMemoryPool's internal codes over P2P. | ||||
if (enable_bip61 && state.GetRejectCode() > 0 && | if (enable_bip61 && state.GetRejectCode() > 0 && | ||||
▲ Show 20 Lines • Show All 1,937 Lines • Show Last 20 Lines |