From 58e09f244b4bf07d31bc8dd4e939c2dc4dc74f3a Mon Sep 17 00:00:00 2001 From: glozow Date: Wed, 14 Aug 2024 10:33:21 +0100 Subject: [PATCH] [p2p] don't log tx invs when in IBD These invs are ignored anyway, and this allows us to more easily move the inv handling to TxDownloadManager in the next commit. --- src/net_processing.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 8013b76bca8..1ba1e853e71 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -4130,12 +4130,14 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, return; } const GenTxid gtxid = ToGenTxid(inv); - const bool fAlreadyHave = m_txdownloadman.AlreadyHaveTx(gtxid, /*include_reconsiderable=*/true); - LogDebug(BCLog::NET, "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom.GetId()); - AddKnownTx(*peer, inv.hash); - if (!fAlreadyHave && !m_chainman.IsInitialBlockDownload()) { - AddTxAnnouncement(pfrom, gtxid, current_time); + + if (!m_chainman.IsInitialBlockDownload()) { + const bool fAlreadyHave = m_txdownloadman.AlreadyHaveTx(gtxid, /*include_reconsiderable=*/true); + LogDebug(BCLog::NET, "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom.GetId()); + if (!fAlreadyHave) { + AddTxAnnouncement(pfrom, gtxid, current_time); + } } } else { LogDebug(BCLog::NET, "Unknown inv type \"%s\" received from peer=%d\n", inv.ToString(), pfrom.GetId());