Browse Source

the first contract test based interface is OK.

tags/1.0.0
zhaoguangwei 5 years ago
parent
commit
a67ab58873
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      source/contract/contract-jvm/src/main/java/com/jd/blockchain/contract/jvm/JavaContractCode.java

+ 7
- 1
source/contract/contract-jvm/src/main/java/com/jd/blockchain/contract/jvm/JavaContractCode.java View File

@@ -10,7 +10,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.util.ReflectionUtils; import org.springframework.util.ReflectionUtils;
import org.springframework.util.SerializationUtils; import org.springframework.util.SerializationUtils;


import java.lang.reflect.Array;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Type;


/** /**
* contract code based jvm * contract code based jvm
@@ -75,7 +77,11 @@ public class JavaContractCode implements ContractCode {
Method handleMethod = ContractType.resolve(myClass).getHandleMethod(contractEventContext.getEvent()); Method handleMethod = ContractType.resolve(myClass).getHandleMethod(contractEventContext.getEvent());
Object args = resolveArgs(contractEventContext.getArgs()); Object args = resolveArgs(contractEventContext.getArgs());


ReflectionUtils.invokeMethod(handleMethod, contractMainClassObj, args);
Object[] params = null;
if(args.getClass().isArray()){
params = (Object[])args;
}
ReflectionUtils.invokeMethod(handleMethod, contractMainClassObj, params);


LOGGER.info("合约执行,耗时:" + (System.currentTimeMillis() - startTime)); LOGGER.info("合约执行,耗时:" + (System.currentTimeMillis() - startTime));




Loading…
Cancel
Save