mirror of
				https://gitee.com/BDWare/cm
				synced 2025-11-04 02:22:14 +00:00 
			
		
		
		
	update logs
This commit is contained in:
		
							parent
							
								
									cdf94fc50d
								
							
						
					
					
						commit
						8efc164d99
					
				@ -139,18 +139,15 @@ public class ContractClient {
 | 
			
		||||
        String strEvent = get.syncGet("", "getDeclaredEvents", "");
 | 
			
		||||
        LOGGER.debug("event: " + strEvent);
 | 
			
		||||
        contractMeta.declaredEvents = JsonUtil.fromJson(strEvent,
 | 
			
		||||
                new TypeToken<Map<String, REventSemantics>>() {
 | 
			
		||||
                }.getType());
 | 
			
		||||
                new TypeToken<Map<String, REventSemantics>>() {}.getType());
 | 
			
		||||
        LOGGER.info("initProps ---- position-----3");
 | 
			
		||||
        contractMeta.dependentContracts =
 | 
			
		||||
                JsonUtil.fromJson(get.syncGet("", "getDependentContracts", ""),
 | 
			
		||||
                        new TypeToken<Set<String>>() {
 | 
			
		||||
                        }.getType());
 | 
			
		||||
                        new TypeToken<Set<String>>() {}.getType());
 | 
			
		||||
        LOGGER.info("initProps ---- position-----4");
 | 
			
		||||
        contractMeta.exportedFunctions =
 | 
			
		||||
                JsonUtil.fromJson(get.syncGet("", "getExportedFunctions", ""),
 | 
			
		||||
                        new TypeToken<List<FunctionDesp>>() {
 | 
			
		||||
                        }.getType());
 | 
			
		||||
                        new TypeToken<List<FunctionDesp>>() {}.getType());
 | 
			
		||||
        contractMeta.logDetail = new HashMap<>();
 | 
			
		||||
        for (FunctionDesp func : contractMeta.exportedFunctions) {
 | 
			
		||||
            StringBuilder str = new StringBuilder();
 | 
			
		||||
@ -180,8 +177,7 @@ public class ContractClient {
 | 
			
		||||
 | 
			
		||||
            String anno = get.syncGet("", "getAnnotations", "");
 | 
			
		||||
            contractMeta.annotations =
 | 
			
		||||
                    JsonUtil.fromJson(anno, new TypeToken<List<AnnotationNode>>() {
 | 
			
		||||
                    }.getType());
 | 
			
		||||
                    JsonUtil.fromJson(anno, new TypeToken<List<AnnotationNode>>() {}.getType());
 | 
			
		||||
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            // supoort contract process before version 0.70
 | 
			
		||||
@ -265,7 +261,7 @@ public class ContractClient {
 | 
			
		||||
        pbParameters.toArray(result);
 | 
			
		||||
        Constructor<ProcessBuilder> pbc =
 | 
			
		||||
                ProcessBuilder.class.getDeclaredConstructor(String[].class);
 | 
			
		||||
        builder = pbc.newInstance(new Object[]{result});
 | 
			
		||||
        builder = pbc.newInstance(new Object[] {result});
 | 
			
		||||
 | 
			
		||||
        File directory = new File("./");
 | 
			
		||||
        LOGGER.debug("[CMD] path: " + directory.getAbsolutePath());
 | 
			
		||||
@ -330,7 +326,7 @@ public class ContractClient {
 | 
			
		||||
        } else {
 | 
			
		||||
            LOGGER.info("setMember ignore, meta:" + (multiContractMeta == null)
 | 
			
		||||
                    + (multiContractMeta == null ? "NULL"
 | 
			
		||||
                    : " members:" + multiContractMeta.getMembers()));
 | 
			
		||||
                            : " members:" + multiContractMeta.getMembers()));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (isBundlePath(contractMeta.contract.getScriptStr())) {
 | 
			
		||||
 | 
			
		||||
@ -104,7 +104,7 @@ public class ContractManager {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static String convertToBytes(long traffic) {
 | 
			
		||||
        String[] unit = new String[]{"B", "KB", "MB", "GB", "TB"};
 | 
			
		||||
        String[] unit = new String[] {"B", "KB", "MB", "GB", "TB"};
 | 
			
		||||
        double d = traffic;
 | 
			
		||||
        int i;
 | 
			
		||||
        for (i = 0; i < unit.length - 1; i++) {
 | 
			
		||||
@ -368,7 +368,7 @@ public class ContractManager {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void checkPointToLedger(OnHashCallback cb, String contractID, String data,
 | 
			
		||||
                                          String requestID) {
 | 
			
		||||
            String requestID) {
 | 
			
		||||
        boolean isMaster = instance.getContractIsMaster(contractID);
 | 
			
		||||
        if (!isMaster) {
 | 
			
		||||
            LOGGER.info("非合约 " + contractID + "的master,无需承担checkPoint上链任务!");
 | 
			
		||||
@ -898,8 +898,8 @@ public class ContractManager {
 | 
			
		||||
                    config.setMockConfig(mockYPK);
 | 
			
		||||
                    // client.setProjectConfig(JsonUtil.toJson(config));
 | 
			
		||||
                } // else {
 | 
			
		||||
                // bubian
 | 
			
		||||
                // }
 | 
			
		||||
                  // bubian
 | 
			
		||||
                  // }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -1182,7 +1182,7 @@ public class ContractManager {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void executeInternalAsync(ContractClient client, ContractRequest request,
 | 
			
		||||
                                      ResultCallback rcb, OnHashCallback cb) {
 | 
			
		||||
            ResultCallback rcb, OnHashCallback cb) {
 | 
			
		||||
        ContractResult cr;
 | 
			
		||||
 | 
			
		||||
        long start = System.currentTimeMillis();
 | 
			
		||||
@ -1223,7 +1223,7 @@ public class ContractManager {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private String executeInternal(ContractClient client, ContractRequest request,
 | 
			
		||||
                                   OnHashCallback ocb) {
 | 
			
		||||
            OnHashCallback ocb) {
 | 
			
		||||
        // LOGGER.info("ContractManager executeInternal : ");
 | 
			
		||||
 | 
			
		||||
        ContractResult cr;
 | 
			
		||||
@ -1254,7 +1254,7 @@ public class ContractManager {
 | 
			
		||||
     * @author Kaidong Wu
 | 
			
		||||
     */
 | 
			
		||||
    public void extractEventsFromContractResult(OnHashCallback ocb, JsonObject result,
 | 
			
		||||
                                                ContractClient client, ContractRequest request, long startTime) {
 | 
			
		||||
            ContractClient client, ContractRequest request, long startTime) {
 | 
			
		||||
        try {
 | 
			
		||||
            ContractResult cr = JsonUtil.fromJson(result, ContractResult.class);
 | 
			
		||||
            if (null != cr.events && !cr.events.isEmpty()) {
 | 
			
		||||
@ -1305,7 +1305,7 @@ public class ContractManager {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void executeContractInternal(ContractRequest cr, final ResultCallback rcb,
 | 
			
		||||
                                        final OnHashCallback hcb) {
 | 
			
		||||
            final OnHashCallback hcb) {
 | 
			
		||||
        LOGGER.debug(JsonUtil.toJson(cr));
 | 
			
		||||
        ContractMeta meta = statusRecorder.getContractMeta(cr.getContractID());
 | 
			
		||||
        MultiContractMeta multiMeta =
 | 
			
		||||
@ -1795,15 +1795,14 @@ public class ContractManager {
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    public void addLocalContractLog(String action, String contractId, String contractName,
 | 
			
		||||
                                    String pubKey) {
 | 
			
		||||
            String pubKey) {
 | 
			
		||||
        String sb = "{\"action\":\"" + action + "\",\"pubKey\":\"" + pubKey + "\",\"contractID\":\""
 | 
			
		||||
                + contractId + "\",\"contractName\":\"" + contractName + "\",\"date\":"
 | 
			
		||||
                + System.currentTimeMillis() + "}";
 | 
			
		||||
        logsDB.put(contractName, sb);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void changePermission(String contractFileName, String pmList) {
 | 
			
		||||
    }
 | 
			
		||||
    public void changePermission(String contractFileName, String pmList) {}
 | 
			
		||||
 | 
			
		||||
    // public String getSyncType(String contractName) {
 | 
			
		||||
    // ContractClient client = getByName(contractName);
 | 
			
		||||
@ -1854,8 +1853,8 @@ public class ContractManager {
 | 
			
		||||
    // }
 | 
			
		||||
 | 
			
		||||
    public void addLocalContractLog(String action, String contractId, String contractName,
 | 
			
		||||
                                    String pubKey, String function, String costTime, long totalGas, long executionGas,
 | 
			
		||||
                                    long extraGas, Map<String, String> logType) {
 | 
			
		||||
            String pubKey, String function, String costTime, long totalGas, long executionGas,
 | 
			
		||||
            long extraGas, Map<String, String> logType) {
 | 
			
		||||
        contractCounter.inc();
 | 
			
		||||
        if (logType == null || logType.isEmpty()) {
 | 
			
		||||
            logsDB.put(contractName,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user