[WIP] This requires #22253 and is built on top of #21800, please review them first.
This PR implements deduplication of package transactions that have the same txid as transaction(s) in the mempool. In that sense, our policy changes because it is no longer all-or-nothing. I would still call it “atomic” because it either decides (1) all transactions may be submitted to mempool or (2) there should be no change to the mempool. Importantly, we deduplicate by txid rather than wtxid - a transaction with the same nonwitness data should be sufficient to validate the descendants in the package.
I consider this a prerequisite to submission of packages to mempool, because it would be a rather annoying limitation if we couldn’t tell that the package was already partially in the mempool. It could also be problematic if someone could submit the transaction with a different witness to cause the package to be rejected.