Search in sources :

Example 11 with TrieStore

use of co.rsk.trie.TrieStore in project rskj by rsksmart.

the class DoPrune method doPrune.

public void doPrune(String[] args) throws Exception {
    logger.info("Pruning Database");
    int blocksToProcess = DEFAULT_BLOCKS_TO_PROCESS;
    RskAddress contractAddress = DEFAULT_CONTRACT_ADDRESS;
    CLIInterface.call(rskSystemProperties, args);
    logger.info("Running {},  core version: {}-{}", rskSystemProperties.genesisInfo(), rskSystemProperties.projectVersion(), rskSystemProperties.projectVersionModifier());
    BuildInfo.printInfo();
    long height = this.blockchain.getBestBlock().getNumber();
    String dataSourceName = getDataSourceName(contractAddress);
    logger.info("Datasource Name {}", dataSourceName);
    logger.info("Blockchain height {}", height);
    TrieImpl source = new TrieImpl(new TrieStoreImpl(levelDbByName(this.rskSystemProperties, dataSourceName)), true);
    KeyValueDataSource targetDataSource = levelDbByName(this.rskSystemProperties, dataSourceName + "B");
    TrieStore targetStore = new TrieStoreImpl(targetDataSource);
    this.processBlocks(height - blocksToProcess, source, contractAddress, targetStore);
    targetDataSource.close();
}
Also used : TrieStoreImpl(co.rsk.trie.TrieStoreImpl) TrieImpl(co.rsk.trie.TrieImpl) RskAddress(co.rsk.core.RskAddress) KeyValueDataSource(org.ethereum.datasource.KeyValueDataSource) TrieStore(co.rsk.trie.TrieStore)

Aggregations

TrieStore (co.rsk.trie.TrieStore)11 TrieStoreImpl (co.rsk.trie.TrieStoreImpl)11 HashMapDB (org.ethereum.datasource.HashMapDB)10 Test (org.junit.Test)10 DataWord (org.ethereum.vm.DataWord)7 TrieImpl (co.rsk.trie.TrieImpl)5 RskAddress (co.rsk.core.RskAddress)4 Trie (co.rsk.trie.Trie)4 TestUtils.randomDataWord (org.ethereum.TestUtils.randomDataWord)4 TrieImplHashTest (co.rsk.trie.TrieImplHashTest)3 Repository (org.ethereum.core.Repository)3 ContractDetails (org.ethereum.db.ContractDetails)3 CountDownLatch (java.util.concurrent.CountDownLatch)2 KeyValueDataSource (org.ethereum.datasource.KeyValueDataSource)1