diff --git a/core/src/main/kotlin/com/r3corda/core/contracts/TransactionBuilder.kt b/core/src/main/kotlin/com/r3corda/core/contracts/TransactionBuilder.kt index 4dc36557cd..9b40c65424 100644 --- a/core/src/main/kotlin/com/r3corda/core/contracts/TransactionBuilder.kt +++ b/core/src/main/kotlin/com/r3corda/core/contracts/TransactionBuilder.kt @@ -139,13 +139,12 @@ open class TransactionBuilder( return SignedTransaction(toWireTransaction().serialize(), ArrayList(currentSigs)) } - open fun addInputState(stateAndRef: StateAndRef<*>) = addInputState(stateAndRef.ref, stateAndRef.state.notary) - - fun addInputState(stateRef: StateRef, notary: Party) { + open fun addInputState(stateAndRef: StateAndRef<*>) { check(currentSigs.isEmpty()) + val notary = stateAndRef.state.notary require(notary == this.notary) { "Input state requires notary \"${notary}\" which does not match the transaction notary \"${this.notary}\"." } signers.add(notary.owningKey) - inputs.add(stateRef) + inputs.add(stateAndRef.ref) } fun addAttachment(attachmentId: SecureHash) { diff --git a/test-utils/src/main/kotlin/com/r3corda/testing/TestDSL.kt b/test-utils/src/main/kotlin/com/r3corda/testing/TestDSL.kt index 96b3ee6dbf..40fd227416 100644 --- a/test-utils/src/main/kotlin/com/r3corda/testing/TestDSL.kt +++ b/test-utils/src/main/kotlin/com/r3corda/testing/TestDSL.kt @@ -106,8 +106,8 @@ data class TestTransactionDSLInterpreter private constructor( internal fun toWireTransaction() = transactionBuilder.toWireTransaction() override fun input(stateRef: StateRef) { - val notary = ledgerInterpreter.resolveStateRef(stateRef).notary - transactionBuilder.addInputState(stateRef, notary) + val state = ledgerInterpreter.resolveStateRef(stateRef) + transactionBuilder.addInputState(StateAndRef(state, stateRef)) } override fun _output(label: String?, notary: Party, contractState: ContractState) {