Warm tip: This article is reproduced from serverfault.com, please click

其他-Corda Flow Responder对方逻辑

(其他 - Corda Flow Responder counter party logic)

发布于 2020-12-20 23:50:52

基本上,我具有州生产交易的启动流,涉及3个方:

甲方-我们的身份
乙方-应签署
丙方-应签署

启动流创建新状态并建立事务,然后从其他方收集签名。

乙方甲方应进行自己的特定业务逻辑验证。
如果没有,将这些支票放在Flow Response中是否正确-将其放在何处?
另外,我可以分开响应者代码,例如:

override fun call(): SignedTransaction {
    val signTransactionFlow = object : SignTransactionFlow(otherPartySession) {
        override fun checkTransaction(stx: SignedTransaction) = requireThat {
            val output = stx.tx.outputs.single().data
            
            if (otherPartySession.counterParty == output.participantB) {
               // Do checks for PartyB
            }
            
            if (otherPartySession.counterParty == output.participantC) {
               // Do checks for PartyC
            }
        }
    }
    val txId = subFlow(signTransactionFlow).id

    return subFlow(ReceiveFinalityFlow(otherPartySession, expectedTxId = txId))
}
Questioner
johnbrovi
Viewed
0
Alessandro Baffa 2020-12-21 09:40:36

是的,应将甲方和甲方进行的交易验证放入“响应者”流程中。你提出的解决方案是正确的。更常见的是,Responder流也可以分为不同的节点,一个在PartyB的节点中,一个在PartyC的节点中,这样它们就不会看到彼此的实现。