【问题标题】:How to know which state-delta event corresponds to which block?如何知道哪个 state-delta 事件对应哪个区块?
【发布时间】:2021-03-02 22:21:06
【问题描述】:

我通过订阅事件“sawtooth/state-delta”和“sawtooth/block-commit”将锯齿分类账的一部分与外部数据库同步,因此当分叉发生时,我必须能够识别无效交易如文档中所述:

https://sawtooth.hyperledger.org/faq/transaction-processing/#how-do-i-handle-forks-while-subscribing-to-sawtooth-events

但是,state-delta 事件没有任何属性引用生成它们的块。我得到的最接近的是查看锯齿项目:

https://github.com/hyperledger-archives/sawtooth-supply-chain.git

在该项目中,事件似乎被分组在“EventLists”中,如果您同时订阅“sawtooth/state-delta”和“sawtooth/block-commit”事件,您可以知道 delta 事件对应于如果它们包含在同一个“EventList”中,则阻止。问题是,据我所知,文档并不能保证这种行为。

【问题讨论】:

    标签: hyperledger-sawtooth


    【解决方案1】:

    每个带有块提交事件的事件列表将只有一个块提交事件。如果某个事件在该列表中,则它是由块提交事件中描述的块生成的。

    https://sawtooth.hyperledger.org/docs/core/nightly/1-2/app_developers_guide/zmq_event_subscription.html?highlight=last%20known%20blocks#correlating-events-to-blocks

    【讨论】:

      猜你喜欢
      • 2019-08-17
      • 1970-01-01
      • 2019-11-30
      • 2020-07-11
      • 1970-01-01
      • 2011-07-31
      • 2017-09-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多