If we get a hit across wtxid and txid relay, then it just means this is a legacy transaction and deduping is fine.
Therefore using two sets for the purpose of deduplication is overkill and we can simplify this code.
If we get a hit across wtxid and txid relay, then it just means this is a legacy transaction and deduping is fine.
Therefore using two sets for the purpose of deduplication is overkill and we can simplify this code.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35917.
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline and AI policy for information on the review process. A summary of reviews will appear here.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
imo we should drop invalid bip144 inv types, aka MSG_WITNESS_TX along with this change if you want to do it. Then you only have wtxid for witness relay peers, and txid for non-witness peers
If we get a hit across wtxid and txid relay, then it just means this is
a legacy transaction and deduping is fine.
Therefore using two sets for the purpose of deduplication is overkill
and we can simplify this code.
Right MSG_WITNESS_TX makes the additional motivation incorrect. I think it would be fine to ignore MSG_WITNESS_TX announcements, but that seems like a bigger behaviour change that does not need to be bundled with this one?
EDIT: Dropped the additional motivation from commit message and OP, i think the initial motivation stands on its own.
The runtime cost of having a redundant empty set on the stack (for peers that don't send MSG_WITNESS_TX invs) is near enough to 0 to not matter IMO; and for peers that do send MSG_WITNESS_TX not deduping seems okay as "don't accidently change behaviour". If we are happy to change behaviour (and I think we should) then dropping the MSG_WITNESS_TX invs and reducing to a single set make sense to do at the same time, IMO.
Ok, fair enough. Seems like the taste consensus here would be to go with a clear behaviour change instead.
I may do that in the future, and cherry-pick that change on top, but i think it should be a separate PR.