22
33import lombok .extern .slf4j .Slf4j ;
44import org .springframework .beans .factory .support .DefaultListableBeanFactory ;
5+ import org .springframework .util .ObjectUtils ;
56import org .tron .common .application .Application ;
67import org .tron .common .application .ApplicationFactory ;
78import org .tron .common .application .TronApplicationContext ;
@@ -28,19 +29,23 @@ public static void main(String[] args) {
2829
2930 LogService .load (parameter .getLogbackPath ());
3031
31- if (parameter .isSolidityNode ()) {
32- SolidityNode .start ();
33- return ;
34- }
3532 if (parameter .isKeystoreFactory ()) {
3633 KeystoreFactory .start ();
3734 return ;
3835 }
39- logger .info ("Full node running." );
40- if (Args .getInstance ().isDebug ()) {
41- logger .info ("in debug mode, it won't check energy time" );
36+ if (parameter .isSolidityNode ()) {
37+ logger .info ("Solidity node is running." );
38+ if (ObjectUtils .isEmpty (parameter .getTrustNodeAddr ())) {
39+ throw new TronError (new IllegalArgumentException ("Trust node is not set." ),
40+ TronError .ErrCode .SOLID_NODE_INIT );
41+ }
4242 } else {
43- logger .info ("not in debug mode, it will check energy time" );
43+ logger .info ("Full node running." );
44+ if (Args .getInstance ().isDebug ()) {
45+ logger .info ("in debug mode, it won't check energy time" );
46+ } else {
47+ logger .info ("not in debug mode, it will check energy time" );
48+ }
4449 }
4550
4651 // init metrics first
@@ -55,6 +60,10 @@ public static void main(String[] args) {
5560 Application appT = ApplicationFactory .create (context );
5661 context .registerShutdownHook ();
5762 appT .startup ();
63+ if (parameter .isSolidityNode ()) {
64+ SolidityNode node = context .getBean (SolidityNode .class );
65+ node .run ();
66+ }
5867 appT .blockUntilShutdown ();
5968 }
6069
0 commit comments