当前位置: 首页>>代码示例>>Java>>正文


Java MainNetConfig类代码示例

本文整理汇总了Java中org.ethereum.config.net.MainNetConfig的典型用法代码示例。如果您正苦于以下问题:Java MainNetConfig类的具体用法?Java MainNetConfig怎么用?Java MainNetConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MainNetConfig类属于org.ethereum.config.net包,在下文中一共展示了MainNetConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setup

import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@Before
public void setup() {
    // if not set explicitly
    // this test fails being run by Gradle
    ConfigHelper.CONFIG.setGenesisInfo("frontier.json");

    originalBlockchainConfig = ConfigHelper.CONFIG.getBlockchainConfig();
    ConfigHelper.CONFIG.setBlockchainConfig(MainNetConfig.INSTANCE);
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:10,代码来源:LocalBasicTest.java

示例2: runHomestead

import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
private void runHomestead(String name) throws IOException, ParseException {
    String json = JSONReader.loadJSONFromCommit("BlockchainTests/Homestead/" + name + ".json", shacommit);
    ConfigHelper.CONFIG.setBlockchainConfig(new GenesisConfig());
    try {
        GitHubJSONTestSuite.runGitHubJsonBlockTest(json, Collections.EMPTY_SET);
    } finally {
        ConfigHelper.CONFIG.setBlockchainConfig(MainNetConfig.INSTANCE);
    }
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:10,代码来源:GitHubBlockTest.java

示例3: run

import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
public static List<String> run(StateTestCase stateTestCase2) {
    try {
        SystemProperties.getDefault().setBlockchainConfig(stateTestCase2.getConfig());
        return new StateTestRunner(stateTestCase2).runImpl();
    } finally {
        SystemProperties.getDefault().setBlockchainConfig(MainNetConfig.INSTANCE);
    }
}
 
开发者ID:Aptoide,项目名称:AppCoins-ethereumj,代码行数:9,代码来源:StateTestRunner.java

示例4: clean

import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@After
public void clean() {
    ConfigHelper.CONFIG.setBlockchainConfig(MainNetConfig.INSTANCE);
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:5,代码来源:GitHubStateTest.java

示例5: recover

import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@After
public void recover() {
    ConfigHelper.CONFIG.setBlockchainConfig(MainNetConfig.INSTANCE);
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:5,代码来源:GitHubBasicTest.java

示例6: runDifficultyTest

import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@Test
public void runDifficultyTest() throws IOException, ParseException {

    ConfigHelper.CONFIG.setBlockchainConfig(MainNetConfig.INSTANCE);

    String json = JSONReader.loadJSONFromCommit("BasicTests/difficulty.json", shacommit);

    DifficultyTestSuite testSuite = new DifficultyTestSuite(json);

    for (DifficultyTestCase testCase : testSuite.getTestCases()) {

        logger.info("Running {}\n", testCase.getName());

        BlockHeader current = testCase.getCurrent();
        BlockHeader parent = testCase.getParent();

        assertEquals(testCase.getExpectedDifficulty(), DIFFICULTY_CALCULATOR.calcDifficulty(current, parent));
    }
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:20,代码来源:GitHubBasicTest.java

示例7: runDifficultyFrontierTest

import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@Test
public void runDifficultyFrontierTest() throws IOException, ParseException {

    ConfigHelper.CONFIG.setBlockchainConfig(MainNetConfig.INSTANCE);

    String json = JSONReader.loadJSONFromCommit("BasicTests/difficultyFrontier.json", shacommit);

    DifficultyTestSuite testSuite = new DifficultyTestSuite(json);

    for (DifficultyTestCase testCase : testSuite.getTestCases()) {

        logger.info("Running {}\n", testCase.getName());

        BlockHeader current = testCase.getCurrent();
        BlockHeader parent = testCase.getParent();

        assertEquals(testCase.getExpectedDifficulty(), DIFFICULTY_CALCULATOR.calcDifficulty(current, parent));
    }
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:20,代码来源:GitHubBasicTest.java

示例8: cleanup

import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@AfterClass
public static void cleanup() {
    ConfigHelper.CONFIG.setBlockchainConfig(MainNetConfig.INSTANCE);
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:5,代码来源:ImportLightTest.java

示例9: recover

import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@After
public void recover() {
    SystemProperties.getDefault().setBlockchainConfig(new MainNetConfig());
}
 
开发者ID:Aptoide,项目名称:AppCoins-ethereumj,代码行数:5,代码来源:GitHubTransactionTest.java

示例10: run

import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
private static void run(List<String> checkFiles,
                        String commitSHA,
                        GitHubJSONTestSuite.Network[] networks) throws IOException {

    if (checkFiles.isEmpty()) return;

    List<BlockTestSuite> suites = new ArrayList<>();
    List<String> filenames = new ArrayList<>();
    for (String file : checkFiles) {
        filenames.add(TEST_ROOT + file);
    }
    List<String> jsons = loadJSONsFromCommit(filenames, commitSHA, 64);
    for (String json : jsons) {
        suites.add(new BlockTestSuite(json));
    }

    Map<String, BlockTestCase> testCases = new HashMap<>();
    for (BlockTestSuite suite : suites) {
        Map<String, BlockTestCase> suiteCases = suite.getTestCases(networks);
        testCases.putAll(suiteCases);
    }

    Map<String, Boolean> summary = new HashMap<>();

    for (String testName : testCases.keySet()) {

        BlockTestCase blockTestCase =  testCases.get(testName);
        TestRunner runner = new TestRunner();

        logger.info("\n\n ***************** Running test: {} ***************************** \n\n", testName);

        try {

            SystemProperties.getDefault().setBlockchainConfig(blockTestCase.getConfig());

            List<String> result = runner.runTestCase(blockTestCase);

            logger.info("--------- POST Validation---------");
            if (!result.isEmpty())
                for (String single : result)
                    logger.info(single);

            if (!result.isEmpty())
                summary.put(testName, false);
            else
                summary.put(testName, true);

        } finally {
            SystemProperties.getDefault().setBlockchainConfig(MainNetConfig.INSTANCE);
        }
    }


    logger.info("");
    logger.info("");
    logger.info("Summary: ");
    logger.info("=========");

    int fails = 0; int pass = 0;
    for (String key : summary.keySet()){

        if (summary.get(key)) ++pass; else ++fails;
        String sumTest = String.format("%-60s:^%s", key, (summary.get(key) ? "OK" : "FAIL")).
                replace(' ', '.').
                replace("^", " ");
        logger.info(sumTest);
    }

    logger.info(" - Total: Pass: {}, Failed: {} - ", pass, fails);

    Assert.assertTrue(fails == 0);
}
 
开发者ID:Aptoide,项目名称:AppCoins-ethereumj,代码行数:73,代码来源:BlockchainTestSuite.java

示例11: clean

import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@AfterClass
public static void clean() {
    SystemProperties.getDefault().setBlockchainConfig(MainNetConfig.INSTANCE);
    SystemProperties.getDefault().setRecordInternalTransactionsData(true);
}
 
开发者ID:Aptoide,项目名称:AppCoins-ethereumj,代码行数:6,代码来源:GitHubStateTest.java

示例12: recover

import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@After
public void recover() {
    SystemProperties.getDefault().setBlockchainConfig(MainNetConfig.INSTANCE);
}
 
开发者ID:Aptoide,项目名称:AppCoins-ethereumj,代码行数:5,代码来源:GitHubBasicTest.java

示例13: runDifficultyTest

import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@Test
public void runDifficultyTest() throws IOException, ParseException {

    SystemProperties.getDefault().setBlockchainConfig(MainNetConfig.INSTANCE);

    String json = JSONReader.loadJSONFromCommit("BasicTests/difficulty.json", shacommit);

    DifficultyTestSuite testSuite = new DifficultyTestSuite(json);

    for (DifficultyTestCase testCase : testSuite.getTestCases()) {

        logger.info("Running {}\n", testCase.getName());

        BlockHeader current = testCase.getCurrent();
        BlockHeader parent = testCase.getParent();

        assertEquals(testCase.getExpectedDifficulty(), current.calcDifficulty
                (SystemProperties.getDefault().getBlockchainConfig(), parent));
    }
}
 
开发者ID:Aptoide,项目名称:AppCoins-ethereumj,代码行数:21,代码来源:GitHubBasicTest.java

示例14: runDifficultyFrontierTest

import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@Test
public void runDifficultyFrontierTest() throws IOException, ParseException {

    SystemProperties.getDefault().setBlockchainConfig(MainNetConfig.INSTANCE);

    String json = JSONReader.loadJSONFromCommit("BasicTests/difficultyFrontier.json", shacommit);

    DifficultyTestSuite testSuite = new DifficultyTestSuite(json);

    for (DifficultyTestCase testCase : testSuite.getTestCases()) {

        logger.info("Running {}\n", testCase.getName());

        BlockHeader current = testCase.getCurrent();
        BlockHeader parent = testCase.getParent();

        assertEquals(testCase.getExpectedDifficulty(), current.calcDifficulty(
                SystemProperties.getDefault().getBlockchainConfig(), parent));
    }
}
 
开发者ID:Aptoide,项目名称:AppCoins-ethereumj,代码行数:21,代码来源:GitHubBasicTest.java

示例15: cleanup

import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@AfterClass
public static void cleanup() {
    SystemProperties.getDefault().setBlockchainConfig(MainNetConfig.INSTANCE);
}
 
开发者ID:Aptoide,项目名称:AppCoins-ethereumj,代码行数:5,代码来源:ShortSyncTest.java


注:本文中的org.ethereum.config.net.MainNetConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。