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();
}
Aggregations