【问题标题】:Corda Walking the Chain in finalityFlowCorda 在 finalityFlow 中行走链
【发布时间】:2018-11-15 19:23:22
【问题描述】:

在 Corda 中,FinalityFlow:

  1. 验证发起节点上的事务
  2. 公证交易
  3. 将signedTransaction 持久保存到启动器的保管库
  4. 将事务分发到participants

根据共识,验证涉及走链。

我查看了 FinalityFlow 代码。链式行走到底发生在哪里?

公证人和participants 也走这条链吗?如果是,他们会检查链中每笔交易的签名,但具体发生在代码的哪个位置?

据我了解,SendTransactionFlow 将交易发送给participants 列表中的其他方。对方也请求附件和交易依赖。链式行走实际上发生在哪里?

我需要从编码的角度了解如何走链。

【问题讨论】:

    标签: corda


    【解决方案1】:

    FinalityFlow 中,调用者使用以下行将经过公证的交易发送到所有状态的participants

    subFlow(SendTransactionFlow(session, notarised))
    

    如果我们查看AbstractNode.installCoreFlows,我们会看到该节点为FinalityFlow 安装了一个名为FinalityHandler 的默认处理程序。 FinalityHandler 通过调用ReceiveTransactionFlow 来响应FinalityFlow 中对SendTransactionFlow 的调用。

    ReceiveTransactionFlow内部,我们可以看到节点解析了交易的依赖,验证了交易并检查了它的签名:

    val stx = otherSideSession.receive<SignedTransaction>().unwrap {
        subFlow(ResolveTransactionsFlow(it, otherSideSession))
        it.verify(serviceHub, checkSufficientSignatures)
        it
    }
    

    作为解决ResolveTransactionsFlow 中交易依赖关系的一部分,节点会验证每一个并检查其签名(默认情况下,verify 检查交易上的签名):

    result.forEach {
        it.verify(serviceHub)
        serviceHub.recordTransactions(StatesToRecord.NONE, listOf(it))
    }
    

    如果公证人是验证公证人,公证人只会以这种方式走链。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-08-15
      • 2011-12-04
      • 1970-01-01
      • 2012-11-08
      • 1970-01-01
      • 2018-02-25
      • 2020-03-24
      相关资源
      最近更新 更多