我的节点有一个自定义配置文件,事件流如下:
1.启动我的网络
2.运行创建我的TokenType的流程
3.停止节点
4.将令牌类型标识符添加到自定义配置
5.启动节点
6.现在,我的其他流程可以从自定义配置中读取该值并完成其工作
// Custom config map
Map<String, String> customConfig = new LinkedHashMap<>();
// Assign custom config to nodes
network = new MockNetwork(new MockNetworkParameters().withCordappsForAllNodes(ImmutableList.of(
TestCordapp.findCordapp("xxx").withConfig(customConfig),
// Run the network and my flow that creates some value to be stored in the config
// Stop the nodes
network.stopNodes();
// Add new value to custom config
customConfig.put("new_value", someNewValue);
// Start the nodes
network.startNodes();
但是第二次启动网络时出现此错误:
java.lang.IllegalStateException: Unable to determine which flow to use when responding to:
com.r3.corda.lib.tokens.workflows.flows.rpc.ConfidentialRedeemFungibleTokens.
[com.r3.corda.lib.tokens.workflows.flows.rpc.ConfidentialRedeemFungibleTokensHandler,
com.r3.corda.lib.tokens.workflows.flows.rpc.ConfidentialRedeemFungibleTokensHandler] are all registered
with equal weight.
答案 0 :(得分:0)
corda-app中是否存在多个流程?尝试覆盖现有流时出现类似错误。在flowOverride
下的节点定义中添加deployNodes gradle task
之后,问题就消失了。
示例:
node {
name "O=PartyA,L=London,C=GB"
p2pPort 10004
rpcSettings {
address("localhost:10005")
adminAddress("localhost:10006")
}
rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]]
flowOverride("com.example.flow.ExampleFlow.Initiator",
"com.example.flow.OverrideAcceptor")
}
有关此内容的更多信息,请参见以下链接: https://docs.corda.net/head/flow-overriding.html#configuring-responder-flows https://lankydan.dev/2019/03/02/extending-and-overriding-flows-from-external-cordapps