use of com.radixdlt.harness.simulation.NodeNetworkMessagesModule in project radixdlt by radixdlt.
the class SimulationNodes method createBFTModule.
private Module createBFTModule(ECKeyPair self) {
Module module = Modules.combine(new AbstractModule() {
@Provides
@Self
private BFTNode self() {
return BFTNode.create(self.getPublicKey());
}
@Provides
@Self
private ECPublicKey key() {
return self.getPublicKey();
}
@Provides
private ECKeyPair keyPair() {
return self;
}
@Provides
@LocalSigner
HashSigner hashSigner() {
return self::sign;
}
}, new NodeNetworkMessagesModule(underlyingNetwork), baseModule);
// can break network behavior if incorrect modules are used
if (overrideModules.containsKey(self.getPublicKey())) {
final var nodeOverrideModules = overrideModules.get(self.getPublicKey());
module = Modules.override(module).with(nodeOverrideModules);
}
return module;
}
use of com.radixdlt.harness.simulation.NodeNetworkMessagesModule in project radixdlt by radixdlt.
the class SimulationNodes method createBFTInstance.
private Injector createBFTInstance(ECKeyPair self) {
Module module = Modules.combine(new AbstractModule() {
@Provides
@Self
private BFTNode self() {
return BFTNode.create(self.getPublicKey());
}
@Provides
@Self
private ECPublicKey key() {
return self.getPublicKey();
}
@Provides
@LocalSigner
HashSigner hashSigner() {
return self::sign;
}
}, new NodeNetworkMessagesModule(underlyingNetwork), baseModule);
// can break network behavior if incorrect modules are used
if (overrideModule != null) {
module = Modules.override(module).with(overrideModule);
}
Module byzantineModule = byzantineNodeModules.get(self);
if (byzantineModule != null) {
module = Modules.override(module).with(byzantineModule);
}
return Guice.createInjector(module);
}
Aggregations