Exemple #1
0
  private static File createProgramTraceFile(String txHash) {
    File result = null;

    if (CONFIG.vmTrace() && !isEmpty(CONFIG.vmTraceDir())) {

      String pathname =
          format(
              "%s/%s/%s/%s.json",
              getProperty("user.dir"), CONFIG.databaseDir(), CONFIG.vmTraceDir(), txHash);
      File file = new File(pathname);

      if (file.exists()) {
        if (file.isFile() && file.canWrite()) {
          result = file;
        }
      } else {
        try {
          file.getParentFile().mkdirs();
          file.createNewFile();
          result = file;
        } catch (IOException e) {
          // ignored
        }
      }
    }

    return result;
  }
  public static Ethereum createEthereum() {

    if (CONFIG.databaseReset()) {
      FileUtil.recursiveDelete(CONFIG.databaseDir());
      logger.info("Database reset done");
    }

    return createEthereum(DefaultConfig.class);
  }