class BlockchainServiceImpl implements BlockchainService {

    @Override
    public synchronized <H extends Object, B extends Serializable> boolean contains(H hash, Blockchain blockchain, BlockchainUnitType type) throws IOException, ClassNotFoundException {
        logger.traceEntry("params: {} {} {}", hash, blockchain, type);
        Util.check(hash != null, "hash!=null");
        Util.check(blockchain != null, "blockchain!=null");
        BlockchainPersistenceUnit<H, B> unit = blockchain.getUnit(type);
        Map<H, B> cache = unit.getCache();

        if (cache.containsKey(hash)) {
            logger.trace("cache contains hash");
            return logger.traceExit(true);
        }
        B block = getLocal(hash, blockchain, type);
        return logger.traceExit(block != null);
    }

}