[30.x] Backport #35878 and prep for v30.5

bitcoin/bitcoin: PR #36893

Backport verdict: Incomplete

The one upstream commit for #35878 (1278a5970d → 1bb5289d48) is backported faithfully, and its functional test comes along unchanged. All code differences are expected target-branch adaptations. The #36672 CI backports were already in the base, and the release-prep commits are routine. There is one gap: the v30.5 release notes list three of the four upstream CI PRs that #36672 brought in after v30.4. #35447 (base commit 17fe6566) is missing. The code is correct as it stands; the release notes need that one line added.

Evidence:

Required fixes:

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

Acceptance of MSG_WITNESS_TX announcements was described as an oversight, not an intentional extension of the protocol. The author of #35920 stated that these announcements had never been valid under BIP144 and that introducing wtxidrelay had added wrong-hash announcement filtering without similarly excluding MSG_WITNESS_TX.

The pinned base already accepts this noncanonical announcement type. Its continued acceptance should therefore be understood as preservation of existing behavior, not as a protocol requirement that deduplication introduces or validates.

Source 1

A concrete interoperability concern led the later proposal to retain witness-tx announcements for non-wtxidrelay peers: the discussion reported that /btcwire:0.5.0/neutrino:0.12.0-beta/ announced transactions using InvTypeWitnessTx, linked a Neutrino issue, and subsequently recorded that the proposal had been changed to allow those announcements for non-wtxidrelay peers.

This supplies the compatibility rationale for avoiding an incidental tightening of accepted INV types during deduplication. A noncanonical announcement could originate from deployed client software rather than merely from an adversarial peer. The record supports preserving compatibility for legacy relay, not an unconditional requirement to accept this type under every negotiated mode.

Source 1

The wtxidrelay filtering was introduced to skip announcements using the wrong transaction identifier for the negotiated relay mode. The later compatibility adjustment distinguished non-wtxidrelay peers from wtxidrelay peers rather than abandoning that distinction.

In both pinned trees, ordinary MSG_TX announcements are skipped for wtxidrelay peers and MSG_WTX announcements are skipped for other peers before transaction-announcement processing. Compatibility with witness-tx announcements and enforcement of negotiated identifier semantics are separate concerns.

Source 1

Ralph's inferences

For this narrowly scoped change, deduplication needs to follow the identifier interpretation of an accepted announcement without silently changing which announcements are accepted. MSG_WITNESS_TX belongs with txid announcements, while MSG_WTX belongs in a separate wtxid namespace; negotiated-mode filtering should remain distinct from duplicate detection.

The head leaves the base acceptance and relay-mode checks in place, then groups MSG_WITNESS_TX with MSG_TX in the per-message txid set and uses a separate set for MSG_WTX. This preserves the existing compatibility boundary while avoiding repeated processing. Notably, the pinned base accepts MSG_WITNESS_TX even on wtxidrelay connections; the inspected later discussion does not establish a compatibility need for that broader acceptance.

Source 1

Unresolved disagreements

The inspected record does not establish that accepting MSG_WITNESS_TX from wtxidrelay peers is necessary for interoperability. The concrete compatibility response in #35920 was limited to non-wtxidrelay peers.

Retaining the broader pinned-base behavior can be explained as avoiding an unrelated behavior change in a deduplication backport. It should not be attributed to a documented protocol or client-compatibility requirement.

Source 1