[30.x] Backport #35878

bitcoin/bitcoin: PR #36883

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

Transaction relay needs an identifier that commits to witness data so that avoiding repeated work does not become a transaction-suppression mechanism.

BIP 339 explains the underlying constraint on the identifiers filtered by this patch: an invalid witness can share a txid with a valid transaction. Permanently suppressing that txid after rejection could suppress the valid version; downloading every announcement instead wastes bandwidth and validation work. The pinned code distinguishes MSG_WTX from txid-based inventory, and the new filter preserves that distinction rather than treating every equal 256-bit value as the same announcement.

Source 1 · Source 2

Witness-aware relay is negotiated for backward compatibility, while transaction requests by txid remain useful even on witness-aware connections.

BIP 339 requires MSG_WTX announcements after negotiation but explicitly permits txid-based requests, including requests for parents that were not recently announced. The pinned base and head ignore announcement types that mismatch the connection's relay setting before processing transactions. Their comments separately preserve txid-based orphan-parent fetching. The new deduplication operates after this existing announcement filtering; it does not redefine GETDATA semantics.

Source 1 · Source 2 · Source 3

Transaction download scheduling balances bounded resource use against continued progress, rather than treating every resource limit as a reason to stop requesting transactions.

The historical request-logic overhaul described reducing tracked announcements to 5,000, retaining an explicit relay-permission exception for local bulk announcements, and replacing a hard in-flight cap with additional delay because a sole announcing peer should still be usable. The target branch already tests the announcement limit with and without relay permission. The current change adds a different, message-local optimization before announcement processing; it does not replace those longer-lived scheduling and resource policies.

Source 1 · Source 2 · Source 3

Reducing redundant downloads can cost propagation latency, and delay policies must account for adversaries that announce transactions without delivering them.

During the original wtxid-relay discussion, the author explicitly acknowledged the bandwidth-versus-latency tradeoff and changed an initial delay proposal after identifying an InvBlock attack involving inbound witness-aware peers. This explains why repeated-work suppression and request scheduling are separate concerns. The backport leaves the target branch's existing delay policies intact and filters repeated identifiers only within one received INV.

Source 1 · Source 2

Ralph's inferences

Message-local deduplication removes redundant announcement processing without creating a new persistent prohibition on learning about a transaction.

In the pinned base, each eligible occurrence reaches AddKnownTx and, outside initial block download, AddTxAnnouncement and logging. At the head, only the first occurrence in each identifier namespace does so. The sets are recreated for every INV, and the added test explicitly checks that the identifier is processed again in a later message. This is an optimization of repeated identifiers, not a new rule rejecting conflicting spends or a replacement for rejection caches and download scheduling.

Source 1 · Source 2

The filter follows transaction-identifier semantics rather than deduplicating by raw inventory type.

The inspected ToGenTxid implementation interprets only MSG_WTX as a wtxid; both MSG_TX and MSG_WITNESS_TX are interpreted as txids. The new sets mirror that conversion: the latter two share a set, while MSG_WTX uses another. Tests cover both ordering directions and equal hash bytes in the two namespaces. This preserves an existing parsing behavior; the historical sources inspected do not establish a separate design justification for accepting MSG_WITNESS_TX in unsolicited INV messages.

Source 1

Separate backport assessment — verdict: Needs clarification.

Summary: source-level fidelity is established for the declared change, but the bounded inspection does not establish complete target-branch correctness. Evidence: original commit 1278a5970d5ada0979052a5bad899e896b8ab40b from declared upstream PR #35878 was retrieved and compared with target commit 83941a40d18056d67761e041506dbff283f2cb6c. Its production additions, complete duplicate-INV test, import and test invocation are present. The surrounding Peer reference versus pointer usage reflects the existing target API; the filter is placed at the corresponding point in both versions. SaltedUint256Hasher already exists in the target base. Missing commits: the supplied upstream inventory contains one commit, and that commit is included; no declared source commit or source test is omitted. Interactions: the supplied range contains only this backport, and existing relay negotiation, protocol-rejection and block-INV handling retain their ordering. Release preparation: doc/release-notes.md is already headed v30.4 and contains no #35878 entry; the inspected upstream commit also changes no release-note file, so there is no dropped upstream release-note hunk, but intentional release-note scope remains unconfirmed. Required_fixes: no concrete code fix is established; clarification is needed on target test-helper/downstream compatibility and release-note handling before an unqualified Faithful verdict. Limitations: no execution was performed, and the author's reported functional-test passes are not independently verified or backed by supplied revision-pinned runner records. This assessment makes no merge recommendation.