blockchain - 使用网络引导程序运行时如何摆脱corda中的“未提供流会话”异常?
问题描述
我正在运行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'
解决方案
就像 Sneha 在评论中所说,如果没有更多关于这里代码的上下文,就不可能对这里问题的来源充满信心。
请记住,您希望确保流程会话以类似于您在列表中指定身份并将其提交到最终流程的方式提供。
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())));
}
推荐阅读
- python - 如何从 Python 中的对列表中绘制分组条形图?
- python - 按开始后垃圾邮件发送者的 tkinter gui
- mysql - Sequelize 将多个表关联到具有 2 个外键的 1 个表
- python - 如何将 str.partition 与文本文件一起使用来拆分测验的问题和答案
- unity3d - 为什么 Unity 对象的析构函数会在对象创建之前调用?
- android - 播放本地音频文件时的录音(Android)
- google-photos - 上传后更改 Google 相册的大小
- c - 使用 strcpy 将字符串复制到动态分配的结构属性时出现分段错误
- xpath - Scrapy Xpath 返回空输出
- javascript - 将空行替换为
textarea 中的标签并将其显示为 HTML 有效代码