當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。