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());