@Nullable Sha256Hash getHashByHeight(int height) { Preconditions.checkArgument(height >= 0, "Height mustn't be negative"); final AbstractBlockChain blockChain = linearExtension.getBlockChain(); StoredBlock currentBlock = blockChain.getChainHead(); if (currentBlock == null || currentBlock.getHeight() < height) { return null; } final BlockStore blockStore = blockChain.getBlockStore(); try { while (currentBlock.getHeight() > height) { currentBlock = currentBlock.getPrev(blockStore); if (currentBlock == null) return null; } return currentBlock.getHeader().getHash(); } catch (BlockStoreException ex) { log.error("Error while descending the chain", ex); return null; } }