I am trying to do a contract upgrade after I successfully authorised, I try to initiate the upgrade flow, but the counterparty is hitting an exception. So I'm wondering when/why this is happening.
At the springboot API
val states = queryUnconsumed<ObligationV1>
// Initiate upgrade contract flow.
states.forEach {
val flowInitiate = services.startFlow({ stateAndRef, upgrade -> ContractUpgradeFlow.Initiate(stateAndRef, upgrade) }, it , ObligationContractV2::class.java)
val resultInitiate = flowInitiate.returnValue.getOrThrow()
}
In ContractUpgradeHandler
// Wouldn't this tx always be of type upgrade tx?
val oldStateAndRef = ourSTX!!.tx.outRef<ContractState>(proposal.stateRef.index)
But in SignedTransaction.kt
** Returns the contained [WireTransaction], or throws if this is a notary change or contract upgrade transaction. */
val tx: WireTransaction get() = coreTransaction as WireTransaction
[WARN ] 2018-08-20T10:25:03,573Z [Node thread-1] flow.[fe5bf9ea-fafc-40b6-9b51-31caaa4ee513].run - Terminated by unexpected exception {} java.lang.ClassCastException: net.corda.core.transactions.ContractUpgradeWireTransaction cannot be cast to net.corda.core.transactions.WireTransaction at net.corda.core.transactions.SignedTransaction.getTx(SignedTransaction.kt:62) ~[corda-core-corda-3.0.jar:?] at net.corda.node.services.ContractUpgradeHandler.verifyProposal(CoreFlowHandlers.kt:57) ~[corda-node-corda-3.0.jar:?] at net.corda.core.flows.AbstractStateReplacementFlow$Acceptor.call(AbstractStateReplacementFlow.kt:149) ~[corda-core-corda-3.0.jar:?] at net.corda.core.flows.AbstractStateReplacementFlow$Acceptor.call(AbstractStateReplacementFlow.kt:129) ~[corda-core-corda-3.0.jar:?] at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:96) [corda-node-corda-3.0.jar:?] at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:44) [corda-node-corda-3.0.jar:?] at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1092) [quasar-core-0.7.9-jdk8.jar:0.7.9] at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) [quasar-core-0.7.9-jdk8.jar:0.7.9] at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) [quasar-core-0.7.9-jdk8.jar:0.7.9] at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) [quasar-core-0.7.9-jdk8.jar:0.7.9] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_181] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_181] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_181] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_181] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_181] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_181] at net.corda.node.utilities.AffinityExecutor$ServiceAffinityExecutor$1$thread$1.run(AffinityExecutor.kt:62) [corda-node-corda-3.0.jar:?]