Backport verdict: Needs clarification
Fidelity could not be established from the available evidence.
Evidence:
- Source coverage: sources['bitcoin/bitcoin#35878'] lists a single commit (1278a597…), with missing=[] and already_in_base=[]. Commit eeb3e249… has the trailer 'Rebased-From: 1278a5970d5ada0979052a5bad899e896b8ab40b'. No source commit was left out.
- Code fidelity: in head src/net_processing.cpp, lines 4147-4149 create seen_txids and seen_wtxids from m_txhash_hasher before LOCK2. Lines 4188-4190 pick the set with inv.IsMsgWtx() and
continueon duplicates, after the reject_tx_invs disconnect check and before ToGenTxid/AddKnownTx. This is the same as upstream 1278a597 lines 4343-4345 and 4384-4386. In both trees the wtxidrelay mismatch filter comes first (head 4159-4166, upstream 4355-4362), so the dedup works the same way. - Member placement:
const SaltedUint256Hasher m_txhash_hasher;is at head line 764, between m_rng and m_fee_filter_rounder, as upstream. It is default-constructed and is not in the constructor's initializer list, so the constructor didn't need changing. - Dependencies already on 31.x: SaltedUint256Hasher exists in src/util/hasher.h:18 (a copyable PresaltedSipHasher wrapper), CInv::IsMsgWtx is in src/protocol.h:517, ToGenTxid is in src/protocol.cpp:121-125, and CInv::GetMessageType prints 'witness-' for MSG_WITNESS_FLAG (protocol.cpp:61-62), which the test's 'witness-tx' strings rely on.
- Test fidelity: test_duplicate_tx_inv (head p2p_tx_download.py lines 322-386) and its call in run_test (line 459) match upstream lines 328-392 and 465. The helpers it uses exist on 31.x: TestNode.debug_log_size (test_node.py:570), debug_log_path (:551) and messages.MSG_WITNESS_TX (messages.py:70). On 31.x the 'got inv' log line has two spaces before the have/new marker ('%s %s'), but the test only searches for the 'got inv: <type> <hash>' prefix, so it still matches.
- Compatibility: the backport keeps the existing acceptance of MSG_WITNESS_TX INV entries and handles them as txids, exactly as upstream. It does not take in the separate #35920 proposal to ignore them. Per the captured #35920 discussion, that proposal was later reworked because of Neutrino interoperability. Leaving it out is the expected scope.
- Release prep: CMakeLists.txt changes CLIENT_VERSION_MINOR from 2 to 3. The seven man pages only change version and date strings, which fits because the backport adds no new options. The release notes list #35878 under Net and #35441/#35571 under CI. Those two CI changes are already on the base as 90d20a4c ('Github-Pull: #35441') and 8ce6136f ('Github-Pull: #35571'), and neither was listed in the v31.2 notes. The credits (Greg Sanders, willcl-ark) match the authors of those changes.
- The release-notes mention check in the packet confirms #35878 is mentioned, and the packet reports complete=true with no limitations.
Limitations:
- Nothing was built or run, and no CI or runner records were provided, so compilation and the functional test results on 31.x are not confirmed.
- I hit the history lookup limit before I could check the v31.2 version-bump commit (cfde8285…) against the CI commit dates (2026-10-26). So I couldn't confirm that #35441 and #35571 landed after the v31.2 tag. Their absence from the v31.2 notes suggests they did.
- The test assumes node 0 is out of IBD when the test runs; this is the same assumption as upstream and is backed by the getdata checks in test_large_inv_batch just before it. It was not checked by running it.
- Whether #35920 was merged upstream, and whether it should go to 31.x later, was not checked. It is a separate change and not part of this backport.
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Documented decisions
The historical record distinguishes accidental acceptance from a later compatibility reason for preserving it. The #35920 proposal describes MSG_WITNESS_TX announcements as never protocol-valid and their acceptance alongside wtxidrelay filtering as an oversight—not as an originally designed extension to INV.
At the pinned base, IsGenTxMsg handling accepts this announcement form. At the head, the change explicitly retains it and deduplicates it as a txid. That should be understood as preserving existing permissive behavior, not implementing a protocol requirement to accept witness-flagged INV entries.
A concrete interoperability concern subsequently justified retaining permissive handling: the #35920 discussion reports that /btcwire:0.5.0/neutrino:0.12.0-beta/ announced transactions using InvTypeWitnessTx. The discussion then records changing that proposal to continue allowing witness-tx INV entries for non-wtxidrelay peers.
This supplies a compatibility reason beyond general tolerance of malformed messages: rejecting this announcement form could interrupt transaction announcements from deployed software. The backport continues to process its first occurrence rather than discarding every MSG_WITNESS_TX entry.
Ralph's inferences
Processing only the first eligible MSG_TX or MSG_WITNESS_TX occurrence for a hash preserves the identified compatibility behavior: the nonstandard announcement can still introduce that txid into transaction-download processing. Repeated processing of the two encodings is not necessary for that interoperability.
In the inspected head, both encodings select seen_txids and ToGenTxid maps both to Txid; neither the retained inventory type nor its witness flag is passed to AddTxAnnouncement. Thus either ordering retains one announcement of the same identifier. Filtering precedes deduplication, so an ignored MSG_TX entry on a wtxidrelay connection does not suppress a later MSG_WITNESS_TX entry. MSG_WTX remains in a separate identifier namespace, and the sets reset for each INV message. The added tests encode both MSG_TX/MSG_WITNESS_TX orderings and separate txid/wtxid handling, although they were not executed. This conclusion concerns announcement compatibility, not identical diagnostic output: duplicate log entries are intentionally removed.