尝试启动新的IOUFlow时出现流错误

时间:2019-06-03 10:26:48

标签: java corda

我在这里关注文档中的教程,我相应地编辑了文件并部署了节点,当尝试启动新流程时,出现以下错误

我正在从节点B运行以下命令

"start IOUFlow iouValue: 99, otherParty: "O=PartyB,L=New York,C=US"

,错误是:

[INFO ] 2019-06-03T10:17:30,437Z [pool-8-thread-2] shell.StartShellCommand.main - Executing command "start IOUFlow iouValue: 99, otherParty: "O=PartyB,L=New York,C=US"",
[INFO ] 2019-06-03T10:17:30,601Z [Node thread-1] corda.flow.run - Flow raised an error... sending it to flow hospital {actor_id=internalShell, actor_owning_identity=O=PartyB, L=New York, C=US, actor_store_id=NODE_CONFIG, fiber-id=10000002, flow-id=61680a4f-1ecd-49f6-9e4e-639f8fef1a47, invocation_id=b3b77b97-92ab-4f8d-8108-910ad6681120, invocation_timestamp=2019-06-03T10:17:30.547Z, origin=internalShell, session_id=4184f80f-5f43-494c-a364-aacb5cf6396f, session_timestamp=2019-06-03T10:14:07.053Z, thread-id=190}
java.lang.IllegalArgumentException: Do not provide flow sessions for the local node. FinalityFlow will record the notarised transaction locally.
at net.corda.core.flows.FinalityFlow.call(FinalityFlow.kt:124) ~[corda-core-4.0.jar:?]
at net.corda.core.flows.FinalityFlow.call(FinalityFlow.kt:39) ~[corda-core-4.0.jar:?]
at net.corda.node.services.statemachine.FlowStateMachineImpl.subFlow(FlowStateMachineImpl.kt:290) ~[corda-node-4.0.jar:?]
at net.corda.core.flows.FlowLogic.subFlow(FlowLogic.kt:314) ~[corda-core-4.0.jar:?]
at com.template.flows.IOUFlow.call(IOUFlow.java:62) ~[?:?]
at com.template.flows.IOUFlow.call(IOUFlow.java:16) ~[?:?]
at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:228) ~[corda-node-4.0.jar:?]
at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:45) ~[corda-node-4.0.jar:?]
at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1092) ~[quasar-core-0.7.10-jdk8.jar:0.7.10]
at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) ~[quasar-core-0.7.10-jdk8.jar:0.7.10]
at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) ~[quasar-core-0.7.10-jdk8.jar:0.7.10]
at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) ~[quasar-core-0.7.10-jdk8.jar:0.7.10]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_201]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_201]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) ~[?:1.8.0_201]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[?:1.8.0_201]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[?:1.8.0_201]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[?:1.8.0_201]
at net.corda.node.utilities.AffinityExecutor$ServiceAffinityExecutor$1$thread$1.run(AffinityExecutor.kt:63) ~[corda-node-4.0.jar:?]

IOUFlow代码:

@Suspendable
@Override
public Void call() throws FlowException {
    // We retrieve the notary identity from the network map.
    Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0);

    // We create the transaction components.
    IOUState outputState = new IOUState(iouValue, getOurIdentity(), otherParty);
    Command command = new Command<>(new TemplateContract.Commands.Action(), getOurIdentity().getOwningKey());

    // We create a transaction builder and add the components.
    TransactionBuilder txBuilder = new TransactionBuilder(notary)
            .addOutputState(outputState, TemplateContract.ID)
            .addCommand(command);

    // Signing the transaction.
    SignedTransaction signedTx = getServiceHub().signInitialTransaction(txBuilder);

    // Creating a session with the other party.
    FlowSession otherPartySession = initiateFlow(otherParty);

    // We finalise the transaction and then send it to the counterparty.
    subFlow(new FinalityFlow(signedTx, otherPartySession));

    return null;
}

cmd output

我该怎么办?

2 个答案:

答案 0 :(得分:1)

您正在尝试启动一个流程,其中节点B既是发起方又是目标方。这将在Corda 4.0中破坏FinalityFlow

检查here以获得更多详细信息和解决方法。

答案 1 :(得分:0)

您正在尝试打开与本地节点的会话。

A.k.a,您正在甲方的节点上运行流,并尝试向甲方发送交易。