Skip to content

Commit

Permalink
[p2p] don't query orphanage by txid
Browse files Browse the repository at this point in the history
  • Loading branch information
glozow committed May 10, 2024
1 parent 842f7fd commit 9d2e905
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2295,7 +2295,12 @@ bool PeerManagerImpl::AlreadyHaveTx(const GenTxid& gtxid, bool include_reconside

const uint256& hash = gtxid.GetHash();

if (m_orphanage.HaveTx(gtxid)) return true;
// Always query by wtxid, even if gtxid has a Txid type.
// It is possible that the transaction in the orphanage has the same txid but a different
// witness (e.g. malleated by an attacker) and we don't want to return false positives.
// However, we are interested in finding non-segwit transactions whose txid == wtxid.
// So query this txid "casted" to a wtxid.
if (m_orphanage.HaveTx(GenTxid::Wtxid(hash))) return true;

if (include_reconsiderable && m_recent_rejects_reconsiderable.contains(hash)) return true;

Expand Down

0 comments on commit 9d2e905

Please sign in to comment.