The BlockItemStore is shared by several classes that need to store information attached to specific blocks (BlockCache/BlockProcessor/BlockchainMachine); moreover, it handles the "batching" to make sure that no inconsistent states are persisted.
The class is too tightly coupled with the other classes, and it is not clear whose responsibility it is to create the batches, and when they should be opened/committed.
This suggestes a bigger refactoring is due, which might now take advantage of the fact that both the newBlock and the newHead events are now emitted by the BlockProcessor after #373.
The BlockItemStore is shared by several classes that need to store information attached to specific blocks (BlockCache/BlockProcessor/BlockchainMachine); moreover, it handles the "batching" to make sure that no inconsistent states are persisted.
The class is too tightly coupled with the other classes, and it is not clear whose responsibility it is to create the batches, and when they should be opened/committed. This suggestes a bigger refactoring is due, which might now take advantage of the fact that both the
newBlock
and thenewHead
events are now emitted by the BlockProcessor after #373.