private static void syncChain() { try { setup(); int startTransactions = wallet.getTransactions(true).size(); DownloadListener listener = new DownloadListener(); peers.startAndWait(); peers.startBlockChainDownload(listener); try { listener.await(); } catch (InterruptedException e) { System.err.println("Chain download interrupted, quitting ..."); System.exit(1); } int endTransactions = wallet.getTransactions(true).size(); if (endTransactions > startTransactions) { System.out.println("Synced " + (endTransactions - startTransactions) + " transactions."); } } catch (BlockStoreException e) { System.err.println("Error reading block chain file " + chainFileName + ": " + e.getMessage()); e.printStackTrace(); } }