@@ -4135,6 +4135,21 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4135
4135
RelayTransaction (tx.GetHash (), tx.GetWitnessHash ());
4136
4136
}
4137
4137
}
4138
+ // If a tx is detected by m_recent_rejects it is ignored. Because we haven't
4139
+ // submitted the tx to our mempool, we won't have computed a DoS
4140
+ // score for it or determined exactly why we consider it invalid.
4141
+ //
4142
+ // This means we won't penalize any peer subsequently relaying a DoSy
4143
+ // tx (even if we penalized the first peer who gave it to us) because
4144
+ // we have to account for m_recent_rejects showing false positives. In
4145
+ // other words, we shouldn't penalize a peer if we aren't *sure* they
4146
+ // submitted a DoSy tx.
4147
+ //
4148
+ // Note that m_recent_rejects doesn't just record DoSy or invalid
4149
+ // transactions, but any tx not accepted by the mempool, which may be
4150
+ // due to node policy (vs. consensus). So we can't blanket penalize a
4151
+ // peer simply for relaying a tx that our m_recent_rejects has caught,
4152
+ // regardless of false positives.
4138
4153
return ;
4139
4154
}
4140
4155
@@ -4255,23 +4270,6 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4255
4270
}
4256
4271
}
4257
4272
4258
- // If a tx has been detected by m_recent_rejects, we will have reached
4259
- // this point and the tx will have been ignored. Because we haven't
4260
- // submitted the tx to our mempool, we won't have computed a DoS
4261
- // score for it or determined exactly why we consider it invalid.
4262
- //
4263
- // This means we won't penalize any peer subsequently relaying a DoSy
4264
- // tx (even if we penalized the first peer who gave it to us) because
4265
- // we have to account for m_recent_rejects showing false positives. In
4266
- // other words, we shouldn't penalize a peer if we aren't *sure* they
4267
- // submitted a DoSy tx.
4268
- //
4269
- // Note that m_recent_rejects doesn't just record DoSy or invalid
4270
- // transactions, but any tx not accepted by the mempool, which may be
4271
- // due to node policy (vs. consensus). So we can't blanket penalize a
4272
- // peer simply for relaying a tx that our m_recent_rejects has caught,
4273
- // regardless of false positives.
4274
-
4275
4273
if (state.IsInvalid ()) {
4276
4274
LogPrint (BCLog::MEMPOOLREJ, " %s (wtxid=%s) from peer=%d was not accepted: %s\n " ,
4277
4275
tx.GetHash ().ToString (),
0 commit comments