forked from tronprotocol/java-tron
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFullNode.java
More file actions
44 lines (38 loc) · 1.38 KB
/
FullNode.java
File metadata and controls
44 lines (38 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package org.tron.program;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.tron.common.application.Application;
import org.tron.common.application.ApplicationFactory;
import org.tron.core.Constant;
import org.tron.core.config.DefaultConfig;
import org.tron.core.config.args.Args;
import org.tron.core.services.RpcApiService;
import org.tron.core.services.WitnessService;
@Slf4j
public class FullNode {
/**
* Start the FullNode.
*/
public static void main(String[] args) throws InterruptedException {
logger.info("Full node running.");
Args.setParam(args, Constant.TESTNET_CONF);
Args cfgArgs = Args.getInstance();
ApplicationContext context = new AnnotationConfigApplicationContext(DefaultConfig.class);
if (cfgArgs.isHelp()) {
logger.info("Here is the help message.");
return;
}
Application appT = ApplicationFactory.create(context);
//appT.init(cfgArgs);
RpcApiService rpcApiService = new RpcApiService(appT, context);
appT.addService(rpcApiService);
if (cfgArgs.isWitness()) {
appT.addService(new WitnessService(appT));
}
appT.initServices(cfgArgs);
appT.startServices();
appT.startup();
rpcApiService.blockUntilShutdown();
}
}