class BlockChainImpl implements Blockchain {

    @Override
    public ImportResult tryToConnect(Block block) {
        this.lock.readLock().lock();

        try {
            if (block == null) {
                return ImportResult.INVALID_BLOCK;
            }

            if (!block.isSealed()) {
                panicProcessor.panic("unsealedblock", String.format("Unsealed block %s %s", block.getNumber(), block.getHash()));
                block.seal();
            }

            if (blockRecorder != null) {
                blockRecorder.writeBlock(block);
            }

            try {
                logger.trace("Try connect block hash: {}, number: {}",
                             block.getShortHash(),
                             block.getNumber());

                synchronized (connectLock) {
                    logger.trace("Start try connect");
                    long saveTime = System.nanoTime();
                    ImportResult result = internalTryToConnect(block);
                    long totalTime = System.nanoTime() - saveTime;
                    logger.info("block: num: [{}] hash: [{}], processed after: [{}]nano, result {}", block.getNumber(), block.getShortHash(), totalTime, result);
                    return result;
                }
            } catch (Throwable t) {
                logger.error("Unexpected error: ", t);
                return ImportResult.INVALID_BLOCK;
            }
        }
        finally {
            this.lock.readLock().unlock();
        }
    }

    public  BlockChainImpl(Repository repository,
                          BlockStore blockStore,
                          ReceiptStore receiptStore,
                          TransactionPool transactionPool,
                          EthereumListener listener,
                          BlockValidator blockValidator,
                          boolean flushEnabled,
                          int flushNumberOfBlocks,
                          BlockExecutor blockExecutor);

}