PISAresearch / pisa

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

Blocks can be emitted before blockchain machine has started #391

Closed yahgwai closed 4 years ago

yahgwai commented 4 years ago

Now that we're initialising the blockchain machine at the start, we need to make sure the blockchain machine has already started and set it's initial state.

  1. start block processor to populate the block cache
  2. start the blockchain machine to set the initial state
  3. now register for newly emitted blocks in the blockprocessor

Option 1 split start into 2 methods

Option 2, pass some start stop dependencies, and require that they are started within the start function.

Option 2 seems better - it's easy for a programmer to forget to call 2! start methods.