Backport verdict: Needs clarification
Fidelity could not be established from the available evidence.
Evidence:
- The only upstream commit for #35878 is 1278a5970d5ada0979052a5bad899e896b8ab40b, and it is included as 83941a40d18056d67761e041506dbff283f2cb6c. The packet lists no missing commits and none already in the base, and the PR range contains only this commit, so it can't conflict with other backports.
- src/net_processing.cpp at the PR head, lines 3944-3989: the two seen-hash sets (
seen_txids,seen_wtxids) are created before LOCK2. The checkauto& seen_hashes{inv.IsMsgWtx() ? seen_wtxids : seen_txids}; if (!seen_hashes.insert(inv.hash).second) continue;runs after the m_wtxid_relay mismatch filter (3959-3963) and the reject_tx_invs disconnect (3980-3984), and before ToGenTxid, AddKnownTx(*peer, ...) and AddTxAnnouncement. This matches upstream net_processing.cpp lines 4343-4392 exactly, apart frompeer.vspeer->. - The new member
const SaltedUint256Hasher m_txhash_hasher;(head line 750) is declared between m_rng and m_fee_filter_rounder, as upstream. It isn't in the constructor's initializer list (head lines 1892-1902), so it is default-constructed and adds no member-reordering warning. - src/util/hasher.h and hasher.cpp at the PR head: SaltedUint256Hasher already exists, has a default constructor seeded with FastRandomContext().rand64(), and provides
size_t operator()(const uint256&) const. Copying it intostd::unordered_set<uint256, SaltedUint256Hasher>{0, hasher}is valid. - src/protocol.h line 517 / protocol.cpp lines 121-125: IsMsgWtx() is true only for MSG_WTX, and ToGenTxid treats MSG_TX and MSG_WITNESS_TX as txids. So the shared txid set matches how the branch already interprets these types. CInv::GetMessageType (protocol.cpp lines 58-75) produces 'tx', 'wtx' and 'witness-tx', which are the names the new test expects.
- src/node/txdownloadman_impl.cpp lines 170-224 at the PR head: a second AddTxAnnouncement call for the same peer and identifier changes nothing. TxRequestTracker::ReceivedInv ignores an existing (peer, gtxid) entry, and MaybeAddOrphanResolutionCandidate exits early on HaveTxFromPeer. So the backport only removes repeated work and doesn't change behavior on 30.x, consistent with the upstream PR's 'no change in observable behavior'.
- test/functional/p2p_tx_download.py at the PR head, lines 322-386 and 459: test_duplicate_tx_inv, the MSG_WITNESS_TX import and the run_test call are identical to upstream lines 328-392 and 465. The helpers it relies on all exist on the branch: TestNode.debug_log_size and debug_log_path (test_node.py lines 530 and 549), TestP2PConn(wtxidrelay=...) (line 41), and MSG_WITNESS_TX (messages.py line 67). Earlier tests in the same run already depend on the node being out of IBD, which is also when the 'got inv' log line is written, so the new test starts from the same node state as upstream.
- The branch's 'got inv: %s %s' log format (two spaces) differs from upstream's single space. The test only matches the 'got inv: <type> <64-hex hash>' prefix, so the assertions still work.
- Release notes: the upstream commit doesn't touch any release-note file, so no hunk was dropped. Blame of doc/release-notes.md at the base shows the v30.x entries were added by separate 'doc: update release notes for v30.x/v30.4' commits (979c0d965c, 4186320bb3, edc3e40981), not inside backport commits. So the missing #35878 entry fits branch practice and is left for release preparation.
Limitations:
- I didn't build anything or run any tests. The PR description says p2p_tx_download.py, p2p_orphan_handling.py and p2p_opportunistic_1p1c.py passed locally, but no runner records tied to a specific revision were supplied, so those results are unverified. Unit tests and the rest of the functional suite weren't reported as run.
- Whether #35878 should get a v30.4 release-note entry is a call for release preparation. The branch adds those entries in separate doc commits, so this PR isn't expected to include one.
- The historical sources don't explain why unsolicited MSG_WITNESS_TX announcements are still accepted. The backport keeps the behavior the branch already has and doesn't change it.
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.
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.
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.
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.
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.