Let's say I'm building a transaction with an older version of attachment than what is currently under cordapps/ because I don't want to force counterparty to upgrade. I do addAttachment(attV1) on the transaction, indicating explicit choice of contract version.
This works .. until I add a reference state. In that case, this code in TransactionBuilder.selectContractAttachmentsAndOutputStateConstraints
goes in and selects a cordapp attachment by itself, without consulting what is already on the transaction. In my case, it selects the latest version. Further down, I get the error
net.corda.core.contracts.TransactionVerificationException$ConflictingAttachmentsRejection because I have 2 different attachments for the same contract.
I'm using signature constraints but by looking at the code, HashConstraint would have the same problem. This problem exists with Corda 4.1 and looking at github v4.4, the code is essentially the same.