@Override public Block next() throws NoSuchElementException { if (!hasNext()) throw new NoSuchElementException(); Block next = nextBlock; nextBlock = null; return next; }
@Override public boolean hasNext() { if (nextBlock == null) loadNextBlock(); return nextBlock != null; }
chain = new BlockChain(params, store); BlockFileLoader loader = new BlockFileLoader(params, BlockFileLoader.getReferenceClientBlockFileList());
@Test public void testFirst100KBlocks() throws Exception { NetworkParameters params = MainNetParams.get(); Context context = new Context(params); File blockFile = new File(getClass().getResource("first-100k-blocks.dat").getFile()); BlockFileLoader loader = new BlockFileLoader(params, Arrays.asList(blockFile)); store = createStore(params, 10); resetStore(store); chain = new FullPrunedBlockChain(context, store); for (Block block : loader) chain.add(block); try { store.close(); } catch (Exception e) {} }
final RuleList blockList = generator.getBlocksToTest(false, runExpensiveTests, blockFile); final Map<Sha256Hash, Block> preloadedBlocks = new HashMap<>(); final Iterator<Block> blocks = new BlockFileLoader(params, Arrays.asList(blockFile));
@Override public Block next() throws NoSuchElementException { if (!hasNext()) throw new NoSuchElementException(); Block next = nextBlock; nextBlock = null; return next; }
@Override public boolean hasNext() { if (nextBlock == null) loadNextBlock(); return nextBlock != null; }
@Override public Block next() throws NoSuchElementException { if (!hasNext()) throw new NoSuchElementException(); Block next = nextBlock; nextBlock = null; return next; }
@Override public boolean hasNext() { if (nextBlock == null) loadNextBlock(); return nextBlock != null; }
@Override public Block next() throws NoSuchElementException { if (!hasNext()) throw new NoSuchElementException(); Block next = nextBlock; nextBlock = null; return next; }
@Override public boolean hasNext() { if (nextBlock == null) loadNextBlock(); return nextBlock != null; }