更新时间:2022-11-08 11:28:48
听起来您会收到两个不同的错误消息:
It sounds like you're getting two different error messages:
如果您不尝试启动第二个流会话以获取第二个签名,则会得到类似以下内容的信息:
If you don't try and initiate a second flow-session to get the second signature, you get something like:
net.corda.core.flows.UnexpectedFlowEndException:交易对手流在 O =模拟公司2,L =伦敦,C = GB已完成但未发送数据
net.corda.core.flows.UnexpectedFlowEndException: Counterparty flow on O=Mock Company 2, L=London, C=GB has completed without sending data
如果您确实启动第二个流会话以获取第二个签名,则会得到类似以下内容的信息:
While if you do initiate a second flow-session to get the second signature, you get something like:
java.lang.IllegalStateException:尝试在两次中初始化InitialFlow() 相同的InitiatingFlow com.example.flow.ExampleFlow$Initiator@312d7fe4对于同一方 O =模拟公司2,L =伦敦,C = GB.此版本不支持此功能 科尔达.或者,您可以通过调用以下命令来启动新流程 @InitiatingFlow子流中的initializeFlow().
java.lang.IllegalStateException: Attempted to initiateFlow() twice in the same InitiatingFlow com.example.flow.ExampleFlow$Initiator@312d7fe4 for the same party O=Mock Company 2, L=London, C=GB. This isn't supported in this version of Corda. Alternatively you may initiate a new flow by calling initiateFlow() in an @InitiatingFlow sub-flow.
在第一种情况下,错误是由于交易对手的流程已经完成而引起的.您可以尝试通过创建第二个流程会话来解决此问题,但是每个Initiating
流程只能与给定的交易对手发起一个流程会话.
In the first case, the error is caused by the fact that the counterparty's flow has already completed. You try and get around this by creating a second flow session, but each Initiating
flow can only initiate a single flow-session with a given counterparty.
相反,您只需要修改响应者流程以进行两次签名.例如:
Instead, you simply need to modify the responder flow to sign twice. For example:
@InitiatedBy(Initiator::class)
class Acceptor(val otherPartyFlow: FlowSession) : FlowLogic<Unit>() {
@Suspendable
override fun call() {
val signTransactionFlow = object : SignTransactionFlow(otherPartyFlow) {
override fun checkTransaction(stx: SignedTransaction) = requireThat {
// Transaction checks...
}
}
subFlow(signTransactionFlow)
subFlow(signTransactionFlow)
}
}