use of com.radixdlt.harness.deterministic.NodeEvents.NodeEventProcessor in project radixdlt by radixdlt.
the class OneNodeAlwaysAliveSafetyTest method setup.
@Before
public void setup() {
var allNodes = nodeKeys.stream().map(k -> BFTNode.create(k.getPublicKey())).toList();
this.network = new DeterministicNetwork(allNodes, MessageSelector.firstSelector(), (message, queue) -> message.message() instanceof GetVerticesRequest || message.message() instanceof LocalSyncRequest);
Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(new TypeLiteral<ImmutableSet<BFTNode>>() {
}).toInstance(ImmutableSet.copyOf(allNodes));
}
@ProvidesIntoSet
public NodeEventProcessor<?> updateChecker() {
return new NodeEventProcessor<>(ViewQuorumReached.class, (node, viewQuorumReached) -> {
if (viewQuorumReached.votingResult() instanceof FormedQC && ((FormedQC) viewQuorumReached.votingResult()).getQC().getCommitted().isPresent()) {
lastNodeToCommit = network.lookup(node);
}
});
}
}, new SafetyCheckerModule(), new NodeEventsModule()).injectMembers(this);
this.nodeCreators = nodeKeys.stream().<Supplier<Injector>>map(k -> () -> createRunner(k, allNodes)).toList();
for (var nodeCreator : nodeCreators) {
this.nodes.add(nodeCreator.get());
}
}
Aggregations