Search in sources :

Example 6 with StateRootsStoreImpl

use of co.rsk.db.StateRootsStoreImpl in project rskj by rsksmart.

the class WorldDslProcessor method processBlockChainCommand.

private void processBlockChainCommand(DslCommand cmd) {
    Block parent = world.getBlockByName(cmd.getArgument(0));
    int k = 1;
    while (cmd.getArgument(k) != null) {
        String name = cmd.getArgument(k);
        int difficulty = k;
        if (name != null) {
            StringTokenizer difficultyTokenizer = new StringTokenizer(name, ":");
            name = difficultyTokenizer.nextToken();
            difficulty = difficultyTokenizer.hasMoreTokens() ? parseDifficulty(difficultyTokenizer.nextToken(), k) : k;
        }
        Block block = blockBuilder.difficulty(difficulty).parent(parent).build();
        final ProgramInvokeFactoryImpl programInvokeFactory = new ProgramInvokeFactoryImpl();
        final TestSystemProperties config = new TestSystemProperties();
        StateRootHandler stateRootHandler = new StateRootHandler(config.getActivationConfig(), new StateRootsStoreImpl(new HashMapDB()));
        BlockExecutor executor = new BlockExecutor(config.getActivationConfig(), new RepositoryLocator(world.getTrieStore(), stateRootHandler), new TransactionExecutorFactory(config, world.getBlockStore(), null, new BlockFactory(config.getActivationConfig()), programInvokeFactory, null, world.getBlockTxSignatureCache()));
        executor.executeAndFill(block, parent.getHeader());
        world.saveBlock(name, block);
        parent = block;
        k++;
    }
}
Also used : StateRootsStoreImpl(co.rsk.db.StateRootsStoreImpl) BlockExecutor(co.rsk.core.bc.BlockExecutor) HashMapDB(org.ethereum.datasource.HashMapDB) ProgramInvokeFactoryImpl(org.ethereum.vm.program.invoke.ProgramInvokeFactoryImpl) TransactionExecutorFactory(co.rsk.core.TransactionExecutorFactory) StateRootHandler(co.rsk.db.StateRootHandler) RepositoryLocator(co.rsk.db.RepositoryLocator) StringTokenizer(java.util.StringTokenizer) TestSystemProperties(co.rsk.config.TestSystemProperties)

Aggregations

StateRootHandler (co.rsk.db.StateRootHandler)6 StateRootsStoreImpl (co.rsk.db.StateRootsStoreImpl)6 HashMapDB (org.ethereum.datasource.HashMapDB)6 BlockExecutor (co.rsk.core.bc.BlockExecutor)5 RepositoryLocator (co.rsk.db.RepositoryLocator)5 ProgramInvokeFactoryImpl (org.ethereum.vm.program.invoke.ProgramInvokeFactoryImpl)5 TransactionExecutorFactory (co.rsk.core.TransactionExecutorFactory)4 TestSystemProperties (co.rsk.config.TestSystemProperties)3 BlockChainImpl (co.rsk.core.bc.BlockChainImpl)2 BlockChainBuilder (co.rsk.test.builders.BlockChainBuilder)2 BlockStore (org.ethereum.db.BlockStore)2 PrecompiledContracts (org.ethereum.vm.PrecompiledContracts)2 BlockGenerator (co.rsk.blockchain.utils.BlockGenerator)1 RskAddress (co.rsk.core.RskAddress)1 ConsensusValidationMainchainView (co.rsk.core.bc.ConsensusValidationMainchainView)1 TransactionPoolImpl (co.rsk.core.bc.TransactionPoolImpl)1 HashMapBlocksIndex (co.rsk.db.HashMapBlocksIndex)1 SimplePeer (co.rsk.net.simples.SimplePeer)1 BridgeSupportFactory (co.rsk.peg.BridgeSupportFactory)1 RepositoryBtcBlockStoreWithCache (co.rsk.peg.RepositoryBtcBlockStoreWithCache)1