[31.x] Backport #35878

bitcoin/bitcoin: PR #36882

Backport verdict: Needs clarification

Fidelity could not be established from the available evidence.

Evidence:

Limitations:

Coverage details

Background

Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.

Documented decisions

Witness-aware transaction identifiers reconcile two competing requirements: avoid repeatedly downloading rejected transactions, while preventing an attacker from suppressing a valid transaction by first supplying an invalid witness with the same txid.

Both pinned versions distinguish txid announcements from wtxid announcements before invoking transaction-download logic. The new filter preserves that distinction with separate seen_txids and seen_wtxids sets. This historical rationale explains why identifier semantics matter: a txid does not identify a unique witness-bearing transaction, whereas a wtxid commits to the witness. Deduplicating announcements is not a determination that transactions spending conflicting inputs are interchangeable.

Source 1 · Source 2

WTXID relay was deliberately negotiated per connection to preserve interoperability, and it did not eliminate txid-based requests for transactions whose wtxids are not known, such as missing parents.

The target base already ignores ordinary transaction INV types inconsistent with the connection's wtxidrelay setting. The head retains those checks before deduplication. BIP 339 also explains the existing comment that orphan-parent fetching can use txid GETDATA requests even on a wtxid-relay connection: parent fetching does not require a corresponding INV announcement.

Source 1 · Source 2

Transaction request scheduling was designed to resist announcement racing and withholding, not merely to select the first advertiser. The historical proposal preferred outbound sources, introduced delays, diversified subsequent candidates, and retried after timeout, NOTFOUND, or an invalid-witness response.

The target's AddTxAnnouncement already applies preferred-peer, txid-relay, and overloaded-peer delays before forwarding announcements to the request tracker. Per-message duplicate elimination sits before this machinery; it does not replace the longer-lived accounting of candidate peers and request outcomes. The historical discussion explains why multiple sources and retry opportunities remain valuable even when repeated entries from one message are redundant.

Source 1 · Source 2 · Source 3

Orphan resolution intentionally uses all potential announcing peers to balance bandwidth efficiency, censorship resistance, and peer load. Merely changing the package-request protocol does not make a withholding peer honest.

In the pinned target, AddTxAnnouncement can recognize a known orphan, recalculate its missing parents, and consider the announcer as a resolution candidate before reaching the ordinary already-have check. This explains why an INV can remain useful even for a transaction already downloaded. It also supplies the historical context for avoiding repeated processing within one message without globally suppressing announcements from other peers or later messages.

Source 1 · Source 2 · Source 3

Ralph's inferences

The message-local filter is best understood as removing redundant input-processing work, rather than introducing a new transaction-acceptance or permanent duplicate-rejection policy.

At the base, every eligible transaction entry reaches AddKnownTx and, outside initial block download, AddTxAnnouncement. At the head, only the first occurrence of each identifier in its namespace does so within that INV message. The sets are then discarded. The tests explicitly preserve processing in a later message, group MSG_TX with the already-supported txid interpretation of MSG_WITNESS_TX, and keep txid and wtxid namespaces separate. This scope is consistent with the historical need to retain alternative announcers and later orphan-resolution opportunities; the inspected historical sources do not directly state why this particular filter must have message-local lifetime.

Source 1 · Source 2 · Source 3