@Test public void testBasicChaining() throws Exception { ListenableFuture<StoredBlock> future = testNetChain.getHeightFuture(2); Block b1 = getBlock1(); assertTrue(testNetChain.add(b1)); assertFalse(future.isDone()); Block b2 = getBlock2(); long n = b2.getNonce(); try { b2.setNonce(12345); testNetChain.add(b2); fail(); } catch (VerificationException e) { b2.setNonce(n); } assertTrue(testNetChain.add(b2)); assertTrue(future.isDone()); assertEquals(2, future.get().getHeight()); }
@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(Context context, Wallet wallet, BlockStore blockStore);  BlockChain(NetworkParameters params, Wallet wallet, BlockStore blockStore);  BlockChain(Context context, BlockStore blockStore);  BlockChain(NetworkParameters params, BlockStore blockStore);  BlockChain(Context params, List<? extends Wallet> wallets, BlockStore blockStore);  BlockChain(NetworkParameters params, List<? extends Wallet> 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(Context context, Wallet wallet, BlockStore blockStore);  BlockChain(NetworkParameters params, Wallet wallet, BlockStore blockStore);  BlockChain(Context context, BlockStore blockStore);  BlockChain(NetworkParameters params, BlockStore blockStore);  BlockChain(Context params, List<? extends Wallet> wallets, BlockStore blockStore);  BlockChain(NetworkParameters params, List<? extends Wallet> 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(Context context, Wallet wallet, BlockStore blockStore);  BlockChain(NetworkParameters params, Wallet wallet, BlockStore blockStore);  BlockChain(Context context, BlockStore blockStore);  BlockChain(NetworkParameters params, BlockStore blockStore);  BlockChain(Context params, List<? extends Wallet> wallets, BlockStore blockStore);  BlockChain(NetworkParameters params, List<? extends Wallet> wallets, BlockStore blockStore); @Override boolean add(FilteredBlock block);  }