@@ -241,6 +241,7 @@ public class Manager {
241241 Collections .synchronizedList (Lists .newArrayList ());
242242 // the capacity is equal to Integer.MAX_VALUE default
243243 private BlockingQueue <TransactionCapsule > rePushTransactions ;
244+ @ Getter
244245 private BlockingQueue <TriggerCapsule > triggerCapsuleQueue ;
245246 // log filter
246247 private boolean isRunFilterProcessThread = true ;
@@ -1111,7 +1112,9 @@ private void switchFork(BlockCapsule newHead)
11111112 while (!getDynamicPropertiesStore ()
11121113 .getLatestBlockHeaderHash ()
11131114 .equals (binaryTree .getValue ().peekLast ().getParentHash ())) {
1114- reOrgContractTrigger ();
1115+ if (EventPluginLoader .getInstance ().getVersion () == 0 ) {
1116+ reOrgContractTrigger ();
1117+ }
11151118 reOrgLogsFilter ();
11161119 eraseBlock ();
11171120 }
@@ -1373,11 +1376,26 @@ public void pushBlock(final BlockCapsule block)
13731376 }
13741377
13751378 void blockTrigger (final BlockCapsule block , long oldSolid , long newSolid ) {
1379+ // post block and logs for jsonrpc
13761380 try {
1381+ if (CommonParameter .getInstance ().isJsonRpcHttpFullNodeEnable ()) {
1382+ postBlockFilter (block , false );
1383+ postLogsFilter (block , false , false );
1384+ }
1385+
1386+ if (CommonParameter .getInstance ().isJsonRpcHttpSolidityNodeEnable ()) {
1387+ postSolidityFilter (oldSolid , newSolid );
1388+ }
1389+
1390+ if (EventPluginLoader .getInstance ().getVersion () != 0 ) {
1391+ lastUsedSolidityNum = newSolid ;
1392+ return ;
1393+ }
1394+
13771395 // if event subscribe is enabled, post block trigger to queue
13781396 postBlockTrigger (block );
13791397 // if event subscribe is enabled, post solidity trigger to queue
1380- postSolidityTrigger (oldSolid , newSolid );
1398+ postSolidityTrigger (newSolid );
13811399 } catch (Exception e ) {
13821400 logger .error ("Block trigger failed. head: {}, oldSolid: {}, newSolid: {}" ,
13831401 block .getNum (), oldSolid , newSolid , e );
@@ -1517,7 +1535,8 @@ public TransactionInfo processTransaction(final TransactionCapsule trxCap, Block
15171535
15181536 // if event subscribe is enabled, post contract triggers to queue
15191537 // only trigger when process block
1520- if (Objects .nonNull (blockCap ) && !blockCap .isMerkleRootEmpty ()) {
1538+ if (Objects .nonNull (blockCap ) && !blockCap .isMerkleRootEmpty ()
1539+ && EventPluginLoader .getInstance ().getVersion () == 0 ) {
15211540 String blockHash = blockCap .getBlockId ().toString ();
15221541 postContractTrigger (trace , false , blockHash );
15231542 }
@@ -2096,7 +2115,7 @@ private void postSolidityFilter(final long oldSolidNum, final long latestSolidif
20962115 }
20972116 }
20982117
2099- private void postSolidityTrigger (final long oldSolidNum , final long latestSolidifiedBlockNumber ) {
2118+ private void postSolidityTrigger (final long latestSolidifiedBlockNumber ) {
21002119 if (eventPluginLoaded && EventPluginLoader .getInstance ().isSolidityLogTriggerEnable ()) {
21012120 for (Long i : Args .getSolidityContractLogTriggerMap ().keySet ()) {
21022121 postSolidityLogContractTrigger (i , latestSolidifiedBlockNumber );
@@ -2122,10 +2141,6 @@ private void postSolidityTrigger(final long oldSolidNum, final long latestSolidi
21222141 }
21232142 }
21242143 }
2125-
2126- if (CommonParameter .getInstance ().isJsonRpcHttpSolidityNodeEnable ()) {
2127- postSolidityFilter (oldSolidNum , latestSolidifiedBlockNumber );
2128- }
21292144 lastUsedSolidityNum = latestSolidifiedBlockNumber ;
21302145 }
21312146
@@ -2237,12 +2252,6 @@ private void postLogsFilter(final BlockCapsule blockCapsule, boolean solidified,
22372252 }
22382253
22392254 void postBlockTrigger (final BlockCapsule blockCapsule ) {
2240- // post block and logs for jsonrpc
2241- if (CommonParameter .getInstance ().isJsonRpcHttpFullNodeEnable ()) {
2242- postBlockFilter (blockCapsule , false );
2243- postLogsFilter (blockCapsule , false , false );
2244- }
2245-
22462255 // process block trigger
22472256 long solidityBlkNum = getDynamicPropertiesStore ().getLatestSolidifiedBlockNum ();
22482257 if (eventPluginLoaded && EventPluginLoader .getInstance ().isBlockLogTriggerEnable ()) {
0 commit comments