public DownloadProgressTracker progressBarUpdater () { return model.getDownloadProgressTracker(); }
public DownloadProgressTracker progressBarUpdater() { return model.getDownloadProgressTracker(); }
@Test public void btcWalletTestWithCheckpoint() throws Exception { final byte[] seed = Bitcoin.getEntropyFromPassphrase("sweet field bless symptom play cherry fault curious mechanic cross gift thunder"); EWDerivation ewDerivation = new EWDerivation(seed); final MainNetParams params = MainNetParams.get(); final String blockpath = "./spvblockstore" + System.currentTimeMillis(); //final File blockChainFile = new File(getDir("blockstore_" + receivingId, Context.MODE_PRIVATE), "blockchain.spvchain"); //final String pathname = "./spvblockstore" + System.currentTimeMillis(); //final String pathname = "./spvblockstore1448448596283"; File blockFile = new File(blockpath); BlockStore blockStore = new SPVBlockStore(params, blockFile); StoredBlock chainHead = blockStore.getChainHead(); if(chainHead.getHeight()==0) { //first run CheckpointManager.checkpoint(PARAMS, BitcoinNetwork.getInstance().getCheckPointsStream() , blockStore, EPOCH); } //final StoredBlock checkpointBefore = manager.getCheckpointBefore(startFrom); //blockStore.setChainHead(checkpointBefore); Wallet wallet = new Wallet(PARAMS); BlockChain chain = new BlockChain(params, wallet, blockStore); //BlockChain chain = new BlockChain(params, blockStore); PeerGroup peerGroup = new PeerGroup(params, chain); //peerGroup.addAddress(InetAddress.getByName("10.106.137.73")); peerGroup.setMaxConnections(1); peerGroup.setDownloadTxDependencies(false); //peerGroup.addPeerDiscovery(new DnsDiscovery(params)); //EWFilterProvider provider = new EWFilterProvider( ); //System.out.println("provider " + provider); //peerGroup.addPeerFilterProvider(provider); DownloadProgressTracker downloadProgressTracker = new DownloadProgressTracker(); EWChainListener listener = new EWChainListener(); chain.addListener(listener); //peerGroup.setMaxConnections(10); peerGroup.setFastCatchupTimeSecs(EPOCH); //24 Giugno 2015 12:00 peerGroup.startBlockChainDownload(downloadProgressTracker); long startDownload = System.currentTimeMillis(); peerGroup.downloadBlockChain(); final long endDownload = System.currentTimeMillis() - startDownload; System.out.println("Download run for " + endDownload); System.out.println("---------FINISH----------"); System.out.println("peerGroup.getConnectedPeers()=" + peerGroup.getConnectedPeers()); System.out.println("blockpath " + blockpath); System.out.println("chain.getBestChainHeight()=" + chain.getBestChainHeight() ); System.out.println("chainHeadHeightAtBeginning=" + chainHead.getHeight() ); System.out.println("TX# " + listener.counter); //System.out.println("checkpointBefore.getHeight()=" + checkpointBefore.getHeight() ); //System.out.println("Derivation took " + l); blockStore.close(); //wallet.addFollowingAccountKeys(a,2); }