0

I'm syncronizing part of the sawtooth ledger with an external database by subscribing to events 'sawtooth/state-delta' and 'sawtooth/block-commit', so when a Fork accures I have to be able to recognize invalidated transactions as described in the documentation:

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

However, the state-delta events don't have any attribute referencing the block that generated them. The closest I've gotten is by looking at the sawtooth project:

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

In that project is seems that events are grouped in "EventLists", and that if you subscribe to both to 'sawtooth/state-delta' and 'sawtooth/block-commit' events you can tell a delta event corresponds to a block if they are included in the same "EventList". The problem is that the documentation, as far as I can tell, does not guarantee this behavior.

Luis F.
  • 1,222
  • 1
  • 11
  • 12

1 Answers1

0

Every list of events with a block-commit event will only have one block-commit event. If an event is on that list it was generated by the block described in the block-commit event.

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

Luis F.
  • 1,222
  • 1
  • 11
  • 12