use of org.ethereum.config.blockchain.GenesisConfig in project rskj by rsksmart.
the class ImportLightTest method createBlockchain.
public static BlockChainImpl createBlockchain(Genesis genesis) {
RskSystemProperties config = new RskSystemProperties();
config.setBlockchainConfig(new GenesisConfig(new GenesisConfig.GenesisConstants() {
@Override
public BlockDifficulty getMinimumDifficulty() {
return new BlockDifficulty(BigInteger.ONE);
}
}));
IndexedBlockStore blockStore = new IndexedBlockStore(new HashMap<>(), new HashMapDB(), null);
Repository repository = new RepositoryImpl(config, new TrieStoreImpl(new HashMapDB()));
EthereumListenerAdapter listener = new EthereumListenerAdapter();
KeyValueDataSource ds = new HashMapDB();
ds.init();
ReceiptStore receiptStore = new ReceiptStoreImpl(ds);
BlockChainImpl blockchain = new BlockChainImpl(config, repository, blockStore, receiptStore, null, listener, new AdminInfo(), new DummyBlockValidator());
blockchain.setNoValidation(true);
TransactionPoolImpl transactionPool = new TransactionPoolImpl(config, repository, null, receiptStore, null, listener, 10, 100);
blockchain.setTransactionPool(transactionPool);
Repository track = repository.startTracking();
for (RskAddress addr : genesis.getPremine().keySet()) {
track.createAccount(addr);
track.addBalance(addr, genesis.getPremine().get(addr).getAccountState().getBalance());
}
track.commit();
genesis.setStateRoot(repository.getRoot());
genesis.flushRLP();
blockStore.saveBlock(genesis, genesis.getCumulativeDifficulty(), true);
blockchain.setBestBlock(genesis);
blockchain.setTotalDifficulty(genesis.getCumulativeDifficulty());
return blockchain;
}
use of org.ethereum.config.blockchain.GenesisConfig in project rskj by rsksmart.
the class GitHubStateTest method setup.
@BeforeClass
public void setup() {
// TODO remove this after Homestead launch and shacommit update with actual block number
// for this JSON test commit the Homestead block was defined as 900000
config = new RskSystemProperties();
config.setBlockchainConfig(new AbstractNetConfig() {
{
add(0, new GenesisConfig());
}
});
}
Aggregations