>场景:运行 2 个在较大区域内运行的 Corda 节点(例如 A 和 B)。区域中有 1 个公证节点。
我有 2 个不同的流:第一个流f1
仅在节点 A 上运行,并且只创建存储在本地的事务(如,不涉及其他节点)。第二个流f2
也只在节点A上运行,并创建一个事务,通过向事务添加输入输出对来修改流f1
(s1, s2, ...
)插入的状态,其中输入状态是现有的(s1, s2, ...
)状态,输出状态是修改后的状态(s1', s2', ...
)。流f2
还创建了一个额外的输出状态,因此我们有Sn
输入状态和S(n+1
)输出状态。在流f2
中创建的事务与节点 B 共享。
流f1
运行良好,但一旦我运行流f2
,我在节点 A 中收到以下错误:
net.corda.core.flows.UnexpectedFlowEndException: net.corda.core.flows.NotaryFlow$Client is not registered
.在公证人的日志中,我可以看到相同的错误,当我检查nodeB的日志时,它说:net.corda.core.flows.UnexpectedFlowEndException: Counter-flow errored
我有本地测试,使用能够正常运行的模拟网络。我目前不知道如何调试此问题,或者它是流程本身的错误,还是其他原因。我正在运行版本 4.5.8
下面是在流f2
中创建事务的代码片段(变量已重命名):
val txBuilder = TransactionBuilder(notary)
.addOutputState(additionalState, CustomContract.ID)
.addCommand(
Command(
contract,
additionalState.participants.map { it.owningKey })
)
existingStates.forEach { txBuilder.addInputState(serviceHub.toStateAndRef<CustomState>(it.ref)) }
existingStatesModified.forEach { txBuilder.addOutputState(it, CustomContract.ID) }
// Stage 2.
progressTracker.currentStep = VERIFYING_TRANSACTION
// Verify that the transaction is valid.
txBuilder.verify(serviceHub)
// Stage 3.
progressTracker.currentStep = SIGNING_TRANSACTION
// Sign the transaction.
val partSignedTx = serviceHub.signInitialTransaction(txBuilder)
// Stage 4.
progressTracker.currentStep = GATHERING_SIGS
// Send the state to the counterparty, and receive it back with their signature.
val otherPartySessions = counterParties.map { initiateFlow(it!!) }
val fullySignedTx =
subFlow(CollectSignaturesFlow(partSignedTx, otherPartySessions, GATHERING_SIGS.childProgressTracker()))
// Stage 5.
progressTracker.currentStep = FINALISING_TRANSACTION
// Notarise and record the transaction in both parties' vaults.
require(insertEvent(insuranceEventState.fullEvent)) { "Unable to insert event data into the triple store." }
return subFlow(FinalityFlow(fullySignedTx, otherPartySessions, FINALISING_TRANSACTION.childProgressTracker()))```
事实证明,这是由错误配置的公证人引起的(这是我无法控制的)。