use of com.radixdlt.environment.EventProcessorOnDispatch in project radixdlt by radixdlt.
the class MockedSyncServiceModule method ledgerUpdateEventProcessor.
@Singleton
@ProvidesIntoSet
private EventProcessorOnDispatch<?> ledgerUpdateEventProcessor() {
return new EventProcessorOnDispatch<>(LedgerUpdate.class, update -> {
final LedgerProof headerAndProof = update.getTail();
long stateVersion = headerAndProof.getAccumulatorState().getStateVersion();
long firstVersion = stateVersion - update.getNewTxns().size() + 1;
for (int i = 0; i < update.getNewTxns().size(); i++) {
sharedCommittedCommands.put(firstVersion + i, update.getNewTxns().get(i));
}
if (update.getTail().isEndOfEpoch()) {
logger.info("Epoch Proof: " + (update.getTail().getEpoch() + 1));
sharedEpochProofs.put(update.getTail().getEpoch() + 1, update.getTail());
}
});
}
Aggregations