Corda: Agregar múltiples estados de salida en una sola transacción

En nuestro caso de uso, tenemos que agregar dos estados de salida con diferentes contratos a una transacción. Traté de agregar múltiples estados a la transacción en withItems . Llamo a este flujo desde un RPC pero arroja una exception como java.lang.IllegalArgumentException: List has more than one element. al firmar la transacción.

Así es como estoy agregando múltiples estados de salida:

 val outputstate1 = IouState1(dataModel1, me, otherParty) val outputstate2 = IouState2(dataModel2, me, otherParty) val cmd1 = Command(IouContract1.Commands.Create(), state1.participants.map { it.owningKey }) val cmd2 = Command(IouContract2.Commands.Initiated(), state2.participants.map { it.owningKey }) val txBuilder = TransactionBuilder(TransactionType.General, notary).withItems(state1, state2, cmd1, cmd2) progressTracker.currentStep = VERIFYING_TRANSACTION // Verifying the transaction. txBuilder.toWireTransaction().toLedgerTransaction(serviceHub).verify() progressTracker.currentStep = SIGNING_TRANSACTION // Signing the transaction. val partSignedTx = serviceHub.signInitialTransaction(txBuilder) progressTracker.currentStep = GATHERING_SIGS // Send the state to the counterparty, and receive it back with their signature. val fullySignedTx = subFlow(CollectSignaturesFlow(partSignedTx, GATHERING_SIGS.childProgressTracker())) // Finalising the transaction. progressTracker.currentStep = FINALISING_TRANSACTION // Notarise and record the transaction in both parties' vaults. return subFlow(FinalityFlow(fullySignedTx, FINALISING_TRANSACTION.childProgressTracker())).single() 

Stack trace: –

 net.corda.core.flows.FlowException: java.lang.IllegalArgumentException: List has more than one element. at net.corda.core.flows.SignTransactionFlow.call(CollectSignaturesFlow.kt:202) ~[corda-core-0.14.0.jar:?] at net.corda.core.flows.SignTransactionFlow.call(CollectSignaturesFlow.kt:175) ~[corda-core-0.14.0.jar:?] at net.corda.core.flows.FlowLogic.subFlow(FlowLogic.kt:166) ~[corda-core-0.14.0.jar:?] at com.dwlabcorda.salescontract.LOCReceiverFlow.call(LOCContractFlow.kt:107) ~[tradefinancecorda-0.1.jar:?] at com.dwlabcorda.salescontract.LOCReceiverFlow.call(LOCContractFlow.kt:95) ~[tradefinancecorda-0.1.jar:?] at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:101) [corda-node-0.14.0.jar:?] at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:33) [corda-node-0.14.0.jar:?] at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1067) [quasar-core-0.7.6-jdk8.jar:0.7.6] at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:767) [quasar-core-0.7.6-jdk8.jar:0.7.6] at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) [quasar-core-0.7.6-jdk8.jar:0.7.6] at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) [quasar-core-0.7.6-jdk8.jar:0.7.6] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_144] at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_144] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) [?:1.8.0_144] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [?:1.8.0_144] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_144] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_144] at net.corda.node.utilities.AffinityExecutor$ServiceAffinityExecutor$1$thread$1.run(AffinityExecutor.kt:69) [corda-node-0.14.0.jar:?] Caused by: java.lang.IllegalArgumentException: List has more than one element. at kotlin.collections.CollectionsKt___CollectionsKt.single(_Collections.kt:471) ~[kotlin-stdlib-1.1.1.jar:1.1.1] at com.dwlabcorda.salescontract.LOCReceiverFlow$call$signTransactionFlow$1.checkTransaction(LOCContractFlow.kt:100) ~[tradefinancecorda-0.1.jar:?] at net.corda.core.flows.SignTransactionFlow.call(CollectSignaturesFlow.kt:199) ~[corda-core-0.14.0.jar:?] ... 17 more