Replayed Events between Executions


Tomás Peixinho
 

Good afternoon,

I'm sorry for repeating the question, but I might have sent the last one to the wrong email address, I'm not sure. Anyway, I'm a bit stumped with how the events work in Fabric. What I'm doing is I'm emitting an event in the chaincode using shim.SetEvent(), only on the transactions that actually modify the world state (I have transactions that are just doing partial queries and those are irrelevant to me). On every execution of my program, which receives a file with multiple lines, each being a different transaction, I capture the events that were emitted on each one, in order to check its envelope and see if said transaction actually got committed (using the EnvelopeInfo isValid() function), because there is a chance that it didn't due to phantom reads, and I need to know if they did or not. 

The problem now is that, if I perform a second execution, with a different file and a different set of transactions, the event listener (which I am re-initializing on each run) catches events from the previous execution (more specifically, it catches 10 events from the previous execution), and I am not sure why this is. Is there something that I am doing wrong? Do I have to clean out some structure in order for it to not replay events? Or are the events always being re-emitted once they are sent the first time? And if so, why is it not catching all of the events from the previous run, just 10? Also, what is the structure that is actually "storing" the events? Is it the peers or the channel? I looked for this on the readTheDocs Events page, but I didn't get much from it.

I really need help with this to progress, so please, any help would gladly be appreciated.

Thanks in advance

Tomás

Join fabric@lists.hyperledger.org to automatically receive all group messages.