Corda在FinalityFlow中走链 [英] Corda Walking the Chain in finalityFlow
问题描述
在Corda中,FinityFlow:
In Corda, FinalityFlow:
- 验证发起方节点上的交易
- 公证交易
- 坚持将交易签名到发起人的保险库中
- 将交易分配给
参与者
按照共识,验证涉及到走链.
As per consensus, verification involves walking the chain.
我查看了FinalityFlow代码.沿着链条走的东西到底发生在什么地方?
I looked in FinalityFlow code. Where exactly does the walking-the-chain thing happen?
公证人和参与者
也能走链吗?如果是,他们会检查链中每笔交易的签名,但是在代码中到底发生在什么地方?
Do the notary and the participants
also walk the chain? If yes, they check the signatures on each transaction in the chain, but where exactly in the code does it happen?
据我了解, SendTransactionFlow
将交易发送给参与者
列表上的其他各方.另一方也要求提供附件和交易依存关系.连锁经营实际上在哪里发生?
As per my understanding, SendTransactionFlow
sends the transaction to the other parties on the participants
lists. The other party also requests for attachments and transaction dependencies. Where actually does the walking-the-chain thing happen?
我需要从编码的角度理解链条.
I need to understand walking the chain from a coding perspective.
推荐答案
在 FinalityFlow
中,调用方使用以下行将经过公证的交易发送给所有参与者的参与者
各州:
In FinalityFlow
, the caller uses the following line to send the notarised transaction to the participants
of all the states:
subFlow(SendTransactionFlow(session, notarised))
如果我们查看 AbstractNode.installCoreFlows
,我们会看到该节点为 FinalityFlow
安装了一个名为 FinalityHandler
的默认处理程序. FinalityHandler
通过调用 ReceiveTransactionFlow
响应 FinalityFlow
中对 SendTransactionFlow
的调用.
If we look at AbstractNode.installCoreFlows
, we see that the node installs a default handler for FinalityFlow
called FinalityHandler
. FinalityHandler
responds to the call to SendTransactionFlow
in FinalityFlow
by calling ReceiveTransactionFlow
.
在 ReceiveTransactionFlow
内部,我们可以看到该节点解析了交易的依赖关系,验证了交易并检查了其签名:
Inside ReceiveTransactionFlow
, we can see that the node resolves the transaction's dependencies, verifies the transaction and checks its signatures:
val stx = otherSideSession.receive<SignedTransaction>().unwrap {
subFlow(ResolveTransactionsFlow(it, otherSideSession))
it.verify(serviceHub, checkSufficientSignatures)
it
}
作为在 ResolveTransactionsFlow
中解决交易的依赖关系的一部分,该节点验证每个交易并检查其签名(默认情况下, verify
检查交易中的签名):
As part of resolving the transaction's dependencies in ResolveTransactionsFlow
, the node verifies each one and checks its signatures (by default, verify
checks the signatures on the transaction):
result.forEach {
it.verify(serviceHub)
serviceHub.recordTransactions(StatesToRecord.NONE, listOf(it))
}
如果公证人是有效的公证人,公证人只会以这种方式走动.
The notary will only walk the chain in this way if they are a validating notary.
这篇关于Corda在FinalityFlow中走链的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!