@@ -627,10 +627,9 @@ public static void setParam(final String[] args, final String confFileName) {
627627 .filter (StringUtils ::isNotEmpty )
628628 .orElse (Storage .getIndexSwitchFromConfig (config )));
629629
630- INSTANCE .storage
631- .setTransactionHistoreSwitch (Optional .ofNullable (INSTANCE .storageTransactionHistoreSwitch )
632- .filter (StringUtils ::isNotEmpty )
633- .orElse (Storage .getTransactionHistoreSwitchFromConfig (config )));
630+ INSTANCE .storage .setTransactionHistoreSwitch (Optional .ofNullable (INSTANCE .storageTransactionHistoreSwitch )
631+ .filter (StringUtils ::isNotEmpty )
632+ .orElse (Storage .getTransactionHistoreSwitchFromConfig (config )));
634633
635634 INSTANCE .storage .setPropertyMapFromConfig (config );
636635
@@ -846,11 +845,11 @@ public static void setParam(final String[] args, final String confFileName) {
846845 config .hasPath ("vm.saveInternalTx" ) && config .getBoolean ("vm.saveInternalTx" );
847846
848847 INSTANCE .eventPluginConfig =
849- config .hasPath ("event.subscribe" )?
850- getEventPluginConfig (config ) : null ;
848+ config .hasPath ("event.subscribe" ) ?
849+ getEventPluginConfig (config ) : null ;
851850
852851 INSTANCE .eventFilter =
853- config .hasPath ("event.subscribe.filter" ) ? getEventFilter (config ) : null ;
852+ config .hasPath ("event.subscribe.filter" ) ? getEventFilter (config ) : null ;
854853
855854 initBackupProperty (config );
856855 initRocksDbBackupProperty (config );
@@ -942,44 +941,44 @@ private static void privateKey(final com.typesafe.config.Config config) {
942941 }
943942 }
944943
945- private static EventPluginConfig getEventPluginConfig (final com .typesafe .config .Config config ){
944+ private static EventPluginConfig getEventPluginConfig (final com .typesafe .config .Config config ) {
946945 EventPluginConfig eventPluginConfig = new EventPluginConfig ();
947946
948- if (config .hasPath ("event.subscribe.path" )){
947+ if (config .hasPath ("event.subscribe.path" )) {
949948 String pluginPath = config .getString ("event.subscribe.path" );
950- if (StringUtils .isNotEmpty (pluginPath )){
949+ if (StringUtils .isNotEmpty (pluginPath )) {
951950 eventPluginConfig .setPluginPath (pluginPath .trim ());
952951 }
953952 }
954953
955-
956- if (config .hasPath ("event.subscribe.server" )){
954+ if (config .hasPath ("event.subscribe.server" )) {
957955 String serverAddress = config .getString ("event.subscribe.server" );
958- if (StringUtils .isNotEmpty (serverAddress )){
956+ if (StringUtils .isNotEmpty (serverAddress )) {
959957 eventPluginConfig .setServerAddress (serverAddress .trim ());
960958 }
961959 }
962960
963- if (config .hasPath ("event.subscribe.dbconfig" )){
961+ if (config .hasPath ("event.subscribe.dbconfig" )) {
964962 String dbConfig = config .getString ("event.subscribe.dbconfig" );
965- if (StringUtils .isNotEmpty (dbConfig )){
963+ if (StringUtils .isNotEmpty (dbConfig )) {
966964 eventPluginConfig .setDbConfig (dbConfig .trim ());
967965 }
968966 }
969967
970- if (config .hasPath ("event.subscribe.topics" )){
971- List <TriggerConfig > triggerConfigList = config .getObjectList ("event.subscribe.topics" ).stream ()
972- .map (Args ::createTriggerConfig )
973- .collect (Collectors .toCollection (ArrayList ::new ));
968+ if (config .hasPath ("event.subscribe.topics" )) {
969+ List <TriggerConfig > triggerConfigList = config .getObjectList ("event.subscribe.topics" )
970+ .stream ()
971+ .map (Args ::createTriggerConfig )
972+ .collect (Collectors .toCollection (ArrayList ::new ));
974973
975974 eventPluginConfig .setTriggerConfigList (triggerConfigList );
976975 }
977976
978977 return eventPluginConfig ;
979978 }
980979
981- private static TriggerConfig createTriggerConfig (ConfigObject triggerObject ){
982- if (Objects .isNull (triggerObject )){
980+ private static TriggerConfig createTriggerConfig (ConfigObject triggerObject ) {
981+ if (Objects .isNull (triggerObject )) {
983982 return null ;
984983 }
985984
@@ -989,22 +988,22 @@ private static TriggerConfig createTriggerConfig(ConfigObject triggerObject){
989988 triggerConfig .setTriggerName (triggerName );
990989
991990 String enabled = triggerObject .get ("enable" ).unwrapped ().toString ();
992- triggerConfig .setEnabled ("true" .equalsIgnoreCase (enabled ) ? true : false );
991+ triggerConfig .setEnabled ("true" .equalsIgnoreCase (enabled ) ? true : false );
993992
994993 String topic = triggerObject .get ("topic" ).unwrapped ().toString ();
995994 triggerConfig .setTopic (topic );
996995
997996 return triggerConfig ;
998997 }
999998
1000- private static FilterQuery getEventFilter (final com .typesafe .config .Config config ){
999+ private static FilterQuery getEventFilter (final com .typesafe .config .Config config ) {
10011000 FilterQuery filter = new FilterQuery ();
1002- long fromBlockLong = 0 , toBlockLong = 0 ;
1001+ long fromBlockLong = 0 , toBlockLong = 0 ;
10031002
10041003 String fromBlock = config .getString ("event.subscribe.filter.fromblock" ).trim ();
10051004 try {
1006- fromBlockLong = FilterQuery .parseFromBlockNumber (fromBlock );
1007- } catch (Exception e ){
1005+ fromBlockLong = FilterQuery .parseFromBlockNumber (fromBlock );
1006+ } catch (Exception e ) {
10081007 logger .error ("{}" , e );
10091008 return null ;
10101009 }
@@ -1013,20 +1012,20 @@ private static FilterQuery getEventFilter(final com.typesafe.config.Config confi
10131012 String toBlock = config .getString ("event.subscribe.filter.toblock" ).trim ();
10141013 try {
10151014 toBlockLong = FilterQuery .parseToBlockNumber (toBlock );
1016- } catch (Exception e ){
1015+ } catch (Exception e ) {
10171016 logger .error ("{}" , e );
10181017 return null ;
10191018 }
10201019 filter .setToBlock (toBlockLong );
10211020
10221021 List <String > addressList = config .getStringList ("event.subscribe.filter.contractAddress" );
10231022 addressList = addressList .stream ().filter (address -> StringUtils .isNotEmpty (address )).collect (
1024- Collectors .toList ());
1023+ Collectors .toList ());
10251024 filter .setContractAddressList (addressList );
10261025
10271026 List <String > topicList = config .getStringList ("event.subscribe.filter.contractTopic" );
10281027 topicList = topicList .stream ().filter (top -> StringUtils .isNotEmpty (top )).collect (
1029- Collectors .toList ());
1028+ Collectors .toList ());
10301029 filter .setContractTopicList (topicList );
10311030
10321031 return filter ;
0 commit comments