Source:
protected abstract TransactionOutputChanges connectTransactions(int height, Block block) throws VerificationException, BlockStoreException; protected abstract TransactionOutputChanges connectTransactions(StoredBlock newBlock) throws VerificationException, BlockStoreException, PrunedException; private boolean add(Block block, boolean tryConnecting, @Nullable List<Sha256Hash> filteredTxHashList, @Nullable Map<Sha256Hash, Transaction> filteredTxn) throws BlockStoreException, VerificationException, PrunedException { lock.lock(); try { if (block.equals(getChainHead().getHeader())) { return true; } if (tryConnecting && orphanBlocks.containsKey(block.getHash())) { return false; } if (shouldVerifyTransactions() && block.transactions == null) throw new VerificationException("Got a block header while running in full-block mode"); if (shouldVerifyTransactions() && blockStore.get(block.getHash()) != null) { return true; } final StoredBlock storedPrev; final Integer height; final Set<VerificationFlags> flags; try { block.verifyHeader(); storedPrev = getStoredBlockInCurrentScope(block.getPrevBlockHash()); if (null != storedPrev) { height = storedPrev.getHeight() + 1; } else { height = null; } flags = params.getValidationFlags(block, this.versionTally, height); if (shouldVerifyTransactions()) block.verifyTransactions(height, flags); } catch (VerificationException e) { log.error("Failed to verify block: ", e); log.error(block.getHashAsString()); throw e; } if (storedPrev == null) { checkState(tryConnecting, "bug in tryConnectingOrphans"); log.warn("Block does not connect: prev {}", block.getHashAsString(), block.getPrevBlockHash()); orphanBlocks.put(block.getHash(), new OrphanBlock(block, filteredTxHashList, filteredTxn)); return false; } else { checkState(lock.isHeldByCurrentThread()); params.checkDifficultyTransitions(storedPrev, block, blockStore); connectBlock(block, storedPrev, shouldVerifyTransactions(), filteredTxHashList, filteredTxn); } if (tryConnecting) tryConnectingOrphans(); return true; } finally { lock.unlock(); } }

Target:
protected abstract TransactionOutputChanges connectTransactions(int height, Block block) throws VerificationException, BlockStoreException; protected abstract TransactionOutputChanges connectTransactions(StoredBlock newBlock) throws VerificationException, BlockStoreException, PrunedException; private boolean add(Block block, boolean tryConnecting, @Nullable List<Sha256Hash> filteredTxHashList, @Nullable Map<Sha256Hash, Transaction> filteredTxn) throws BlockStoreException, VerificationException, PrunedException { lock.lock(); try { if (block.equals(getChainHead().getHeader())) { return true; } if (tryConnecting && orphanBlocks.containsKey(block.getHash())) { return false; } if (shouldVerifyTransactions() && block.transactions == null) throw new VerificationException("Got a block header while running in full-block mode"); if (shouldVerifyTransactions() && blockStore.get(block.getHash()) != null) { return true; } final StoredBlock storedPrev; final int height; final EnumSet<VerificationFlags> flags; try { block.verifyHeader(); storedPrev = getStoredBlockInCurrentScope(block.getPrevBlockHash()); if (storedPrev != null) { height = storedPrev.getHeight() + 1; } else { height = Block.BLOCK_HEIGHT_UNKNOWN; } flags = params.getValidationFlags(block, versionTally, height); if (shouldVerifyTransactions()) block.verifyTransactions(height, flags); } catch (VerificationException e) { log.error("Failed to verify block: ", e); log.error(block.getHashAsString()); throw e; } if (storedPrev == null) { checkState(tryConnecting, "bug in tryConnectingOrphans"); log.warn("Block does not connect: prev {}", block.getHashAsString(), block.getPrevBlockHash()); orphanBlocks.put(block.getHash(), new OrphanBlock(block, filteredTxHashList, filteredTxn)); return false; } else { checkState(lock.isHeldByCurrentThread()); params.checkDifficultyTransitions(storedPrev, block, blockStore); connectBlock(block, storedPrev, shouldVerifyTransactions(), filteredTxHashList, filteredTxn); } if (tryConnecting) tryConnectingOrphans(); return true; } finally { lock.unlock(); } }