【问题标题】:How to get rid of 'Flow sessions were not provided' exception in corda when run using network bootstrapper?使用网络引导程序运行时如何摆脱corda中的“未提供流会话”异常?
【发布时间】:2021-10-02 09:55:35
【问题描述】:

我正在运行corda 4.5。使用 gradle 任务 deployNodes 运行时,我的流程运行良好。但是,当我为使用网络引导程序创建的节点运行流程时,我会遇到以下异常。

Mon Jul 26 12:43:10 GMT 2021>>> start CreateAccount name: accountOne

▶︎ Starting
    ✘ Requesting signature by notary service
        ✘ Requesting signature by Notary service
        ✘ Validating response from Notary service
    ✘ Broadcasting transaction to participants
✘ Done
☂ java.lang.IllegalArgumentException: Flow sessions were not provided for the following transaction participants: [O=PartyA, L=New York, C=US]

来自日志:

inMemoryConfigSelectionLogger. - Did not detect a configuration for InMemory selection - enabling memory usage for token indexing. Please set stateSelection.inMemory.enabled to "false" to disable this 
inMemoryConfigSelectionLogger. - No indexing method specified. Indexes will be created at run-time for each invocation of selectTokens - Cordapp configuration is incorrect due to exception - empty config: No configuration setting found for key 'stateSelection'

【问题讨论】:

  • 请添加有关问题的信息,如果您正在运行 deployNodes 任务并且工作正常,则表示您的流程正常。我猜你的引导程序创建的网络不正确。
  • 这是我推荐的博客-corda.net/blog/…
  • 我们需要更多详细信息。你可以粘贴你的代码吗? @user16528894

标签: blockchain corda


【解决方案1】:

就像 Sneha 在 cmets 中所说,如果没有关于这里代码的更多上下文,就不可能对这里问题的根源充满信心。

请记住,您希望确保流程会话的提供方式与您在列表中指定身份并将其提交给最终流程的方式类似。

        Party me = getOurIdentity();
        Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0);
        Command<YoContract.Commands.Send> command = new Command<YoContract.Commands.Send>(new YoContract.Commands.Send(), Arrays.asList(me.getOwningKey()));
        YoState state = new YoState(me, this.target);
        StateAndContract stateAndContract = new StateAndContract(state, YoContract.ID);
        TransactionBuilder utx = new TransactionBuilder(notary).withItems(stateAndContract, command);

        this.progressTracker.setCurrentStep(VERIFYING);
        utx.verify(getServiceHub());

        this.progressTracker.setCurrentStep(SIGNING);
        SignedTransaction stx = getServiceHub().signInitialTransaction(utx);

        this.progressTracker.setCurrentStep(FINALISING);
        FlowSession targetSession = initiateFlow(this.target);
        return subFlow(new FinalityFlow(stx, Collections.singletonList(targetSession), Objects.requireNonNull(FINALISING.childProgressTracker())));
    }

来源:https://github.com/corda/samples-java/blob/master/Features/dockerform-yocordapp/workflows/src/main/java/net/corda/samples/dockerform/flows/YoFlow.java

【讨论】:

    猜你喜欢
    • 2019-03-13
    • 2021-08-13
    • 2013-05-08
    • 2010-12-19
    • 2019-12-06
    • 1970-01-01
    • 1970-01-01
    • 2012-03-19
    • 2023-03-07
    相关资源
    最近更新 更多