PISAresearch / pisa

Accountable Watching Service
https://pisa.watch
28 stars 9 forks source link

BlockProcessor/BlockCache events cleanup #373

Closed bigspider closed 4 years ago

bigspider commented 4 years ago

This PR addresses two issues:

While the logic of the newBlock event is kept in the blockCache, the access to all the other classes (but the blockProcessor) is now granted via the blockProcessor via a proxy, that also makes sure that no events are emitted until the blockProcessor has completed startup.

yahgwai commented 4 years ago

Looks like the best solution. These classes are becoming really intertwined - would be nice to sort them out one day. Hopefully they work well now :crossed_fingers: even if they're complex.

Looking at this made we want some for more focused integration tests for the blockchain machine + processer. It would be nice to have a test that ensures blocks are never missed - even after shutdown/restart. I made a ticket for the future: https://github.com/PISAresearch/pisa/issues/374