net: Avoid logging AlreadyHaveTx when disconnecting misbehaving peer
Can be reviewed with --color-moved=dimmed-zebra
This commit is contained in:
1 file changed
+6
-5
@@ -2949,16 +2949,17 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
|||||||
best_block = &inv.hash;
|
best_block = &inv.hash;
|
||||||
}
|
}
|
||||||
} else if (inv.IsGenTxMsg()) {
|
} else if (inv.IsGenTxMsg()) {
|
||||||
|
if (reject_tx_invs) {
|
||||||
|
LogPrint(BCLog::NET, "transaction (%s) inv sent in violation of protocol, disconnecting peer=%d\n", inv.hash.ToString(), pfrom.GetId());
|
||||||
|
pfrom.fDisconnect = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
const GenTxid gtxid = ToGenTxid(inv);
|
const GenTxid gtxid = ToGenTxid(inv);
|
||||||
const bool fAlreadyHave = AlreadyHaveTx(gtxid);
|
const bool fAlreadyHave = AlreadyHaveTx(gtxid);
|
||||||
LogPrint(BCLog::NET, "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom.GetId());
|
LogPrint(BCLog::NET, "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom.GetId());
|
||||||
|
|
||||||
pfrom.AddKnownTx(inv.hash);
|
pfrom.AddKnownTx(inv.hash);
|
||||||
if (reject_tx_invs) {
|
if (!fAlreadyHave && !m_chainman.ActiveChainstate().IsInitialBlockDownload()) {
|
||||||
LogPrint(BCLog::NET, "transaction (%s) inv sent in violation of protocol, disconnecting peer=%d\n", inv.hash.ToString(), pfrom.GetId());
|
|
||||||
pfrom.fDisconnect = true;
|
|
||||||
return;
|
|
||||||
} else if (!fAlreadyHave && !m_chainman.ActiveChainstate().IsInitialBlockDownload()) {
|
|
||||||
AddTxAnnouncement(pfrom, gtxid, current_time);
|
AddTxAnnouncement(pfrom, gtxid, current_time);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in new issue
Block a user