user85437: Imagine I executed ReadBlockFromDisk and now I have valid instance of CBlock. 
How do I read height of this block?
CBlock block = ...;
CBlockIndex index(block);
assert (index.nHeight != 0); // fails, nHeight is default initialized


user85437: It looks like this function from validation.h does the job:
CBlockIndex* LookupBlockIndex(const uint256& hash)


85437: <p>Imagine I executed <a href="https://github.com/bitcoin/bitcoin/blob/3c40bc6726b6dc639c4ca2c00c720bccd4cd4dc7/src/validation.cpp#L1135" rel="nofollow noreferrer">ReadBlockFromDisk</a> and now I have valid instance of CBlock. </p>

<p>How do I read height of this block?</p>

<pre><code>CBlock block = ...;
CBlockIndex index(block);
assert (index.nHeight != 0); // fails, nHeight is default initialized
</code></pre>
 85437: <p>It looks like this function from <code>validation.h</code> does the job:</p>

<pre><code>CBlockIndex* LookupBlockIndex(const uint256&amp; hash)
</code></pre>
