mirror of
https://github.com/corda/corda.git
synced 2025-04-07 11:27:01 +00:00
Remove addInputState(stateRef, notary) from TransactionBuilder API, as it might lead to issues where someone accidentally provides a different notary than the one in the state
This commit is contained in:
parent
aa166518a0
commit
84247128b4
@ -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) {
|
||||
|
@ -106,8 +106,8 @@ data class TestTransactionDSLInterpreter private constructor(
|
||||
internal fun toWireTransaction() = transactionBuilder.toWireTransaction()
|
||||
|
||||
override fun input(stateRef: StateRef) {
|
||||
val notary = ledgerInterpreter.resolveStateRef<ContractState>(stateRef).notary
|
||||
transactionBuilder.addInputState(stateRef, notary)
|
||||
val state = ledgerInterpreter.resolveStateRef<ContractState>(stateRef)
|
||||
transactionBuilder.addInputState(StateAndRef(state, stateRef))
|
||||
}
|
||||
|
||||
override fun _output(label: String?, notary: Party, contractState: ContractState) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user