@Test public void difficultyTransitions() throws Exception { Block prev = unitTestParams.getGenesisBlock(); Utils.setMockClock(System.currentTimeMillis()/1000); for (int i = 0; i < unitTestParams.getInterval() - 1; i++) { Block newBlock = prev.createNextBlock(coinbaseTo, Utils.currentTimeMillis()/1000); assertTrue(chain.add(newBlock)); prev = newBlock; Utils.rollMockClock(2); } try { chain.add(prev.createNextBlock(coinbaseTo, Utils.currentTimeMillis()/1000)); fail(); } catch (VerificationException e) { } Block b = prev.createNextBlock(coinbaseTo, Utils.currentTimeMillis()/1000); b.setDifficultyTarget(0x201fFFFFL); b.solve(); assertTrue(chain.add(b)); }
@Override public boolean add(FilteredBlock block) throws VerificationException, PrunedException { boolean success = super.add(block); if (success) { trackFilteredTransactions(block.getTransactionCount()); } return success; }
BlockChain extends AbstractBlockChain { @Override public boolean add(FilteredBlock block) throws VerificationException, PrunedException { boolean success = super.add(block); if (success) { trackFilteredTransactions(block.getTransactionCount()); } return success; } }
BlockChain extends AbstractBlockChain { @Override public boolean add(FilteredBlock block) throws VerificationException, PrunedException { boolean success = super.add(block); if (success) { trackFilteredTransactions(block.getTransactionCount()); } return success; } BlockChain(NetworkParameters params, Wallet wallet, BlockStore blockStore);  BlockChain(NetworkParameters params, BlockStore blockStore);  BlockChain(NetworkParameters params, List<BlockChainListener> wallets,
                      BlockStore blockStore); }
BlockChain extends AbstractBlockChain { @Override public boolean add(FilteredBlock block) throws VerificationException, PrunedException { boolean success = super.add(block); if (success) { trackFilteredTransactions(block.getTransactionCount()); } return success; } BlockChain(NetworkParameters params, Wallet wallet, BlockStore blockStore);  BlockChain(NetworkParameters params, BlockStore blockStore);  BlockChain(NetworkParameters params, List<BlockChainListener> wallets,
                      BlockStore blockStore); @Override boolean add(FilteredBlock block); }
BlockChain extends AbstractBlockChain { @Override public boolean add(FilteredBlock block) throws VerificationException, PrunedException { boolean success = super.add(block); if (success) { trackFilteredTransactions(block.getTransactionCount()); } return success; } BlockChain(NetworkParameters params, Wallet wallet, BlockStore blockStore);  BlockChain(NetworkParameters params, BlockStore blockStore);  BlockChain(NetworkParameters params, List<BlockChainListener> wallets,
                      BlockStore blockStore); @Override boolean add(FilteredBlock block);  }