diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-09-20 09:24:42 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-09-20 09:25:02 +0200 |
commit | fa2662c293ec0aaa93092b59b6632f74729c4283 (patch) | |
tree | b97447eda7e9af6a0b4e65205d9da1260dc4d4f5 /src/net_processing.cpp | |
parent | 226731ac1144886d693d3508b331f98727ab883c (diff) |
net: Avoid logging AlreadyHaveTx when disconnecting misbehaving peer
Can be reviewed with --color-moved=dimmed-zebra
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 80655c61e7..8c95603e66 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2949,16 +2949,17 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, best_block = &inv.hash; } } 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 bool fAlreadyHave = AlreadyHaveTx(gtxid); LogPrint(BCLog::NET, "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom.GetId()); pfrom.AddKnownTx(inv.hash); - 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; - } else if (!fAlreadyHave && !m_chainman.ActiveChainstate().IsInitialBlockDownload()) { + if (!fAlreadyHave && !m_chainman.ActiveChainstate().IsInitialBlockDownload()) { AddTxAnnouncement(pfrom, gtxid, current_time); } } else { |