use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.
the class BlockDifficultyValidationRuleTest method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
config = new RskSystemProperties();
config.setBlockchainConfig(new RegTestConfig());
}
use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.
the class SystemPropertiesTest method externalIpTest.
@Test
public void externalIpTest() {
RskSystemProperties config = new RskSystemProperties();
config.overrideParams("public.ip", "");
long st = System.currentTimeMillis();
String ip = config.getPublicIp();
long t = System.currentTimeMillis() - st;
System.out.println(ip + " in " + t + " msec");
Assert.assertTrue(t < 10 * 1000);
Assert.assertFalse(ip.isEmpty());
}
use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.
the class StateTest method generateGenesisState.
private Trie generateGenesisState() {
Trie trie = new TrieImpl();
Genesis genesis = (Genesis) Genesis.getInstance(new RskSystemProperties());
for (RskAddress addr : genesis.getPremine().keySet()) {
trie = trie.put(addr.getBytes(), genesis.getPremine().get(addr).getAccountState().getEncoded());
}
return trie;
}
use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.
the class IndexedBlockStoreTest method setup.
@Before
public void setup() throws URISyntaxException, IOException {
URL scenario1 = ClassLoader.getSystemResource("blockstore/load.dmp");
File file = new File(scenario1.toURI());
List<String> strData = Files.readAllLines(file.toPath(), StandardCharsets.UTF_8);
config = new RskSystemProperties();
Block genesis = Genesis.getInstance(config);
blocks.add(genesis);
cumDifficulty = cumDifficulty.add(genesis.getCumulativeDifficulty());
for (String blockRLP : strData) {
Block block = new Block(Hex.decode(blockRLP));
if (block.getNumber() % 1000 == 0)
logger.info("adding block.hash: [{}] block.number: [{}]", block.getShortHash(), block.getNumber());
blocks.add(block);
cumDifficulty = cumDifficulty.add(block.getCumulativeDifficulty());
}
logger.info("total difficulty: {}", cumDifficulty);
logger.info("total blocks loaded: {}", blocks.size());
}
use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.
the class GitHubBlockTest method runHomestead.
private void runHomestead(String name) throws IOException, ParseException {
String json = JSONReader.loadJSONFromCommit("BlockchainTests/Homestead/" + name + ".json", shacommit);
RskSystemProperties config = new RskSystemProperties();
config.setBlockchainConfig(new GenesisConfig());
try {
GitHubJSONTestSuite.runGitHubJsonBlockTest(json, Collections.EMPTY_SET);
} finally {
config.setBlockchainConfig(new MainNetConfig());
}
}
Aggregations