use of com.radixdlt.hotstuff.bft.Self 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.hotstuff.bft.Self in project radixdlt by radixdlt.
the class Radix method start.
public static void start(RuntimeProperties properties) {
long start = System.currentTimeMillis();
var injector = Guice.createInjector(new RadixNodeModule(properties));
final Map<String, ModuleRunner> moduleRunners = injector.getInstance(Key.get(new TypeLiteral<Map<String, ModuleRunner>>() {
}));
final var p2pNetworkRunner = moduleRunners.get(Runners.P2P_NETWORK);
p2pNetworkRunner.start();
final var systemInfoRunner = moduleRunners.get(Runners.SYSTEM_INFO);
systemInfoRunner.start();
final var syncRunner = moduleRunners.get(Runners.SYNC);
syncRunner.start();
final var mempoolReceiverRunner = moduleRunners.get(Runners.MEMPOOL);
mempoolReceiverRunner.start();
final var peerServer = injector.getInstance(PeerServerBootstrap.class);
try {
peerServer.start();
} catch (InterruptedException e) {
log.error("Cannot start p2p server", e);
}
final var undertow = injector.getInstance(Undertow.class);
undertow.start();
final var consensusRunner = moduleRunners.get(Runners.CONSENSUS);
consensusRunner.start();
final BFTNode self = injector.getInstance(Key.get(BFTNode.class, Self.class));
long finish = System.currentTimeMillis();
var systemCounters = injector.getInstance(SystemCounters.class);
systemCounters.set(SystemCounters.CounterType.STARTUP_TIME_MS, finish - start);
Runtime.getRuntime().addShutdownHook(new Thread(() -> shutdown(injector)));
log.info("Node '{}' started successfully in {} seconds", self, (finish - start) / 1000);
}
Aggregations