refactor: Prefer clean assert over UB in coinstats

This commit is contained in:
MarcoFalke 2021-04-04 07:47:14 +02:00
parent ad4bf8a945
commit fa8fffebe8
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -94,7 +94,8 @@ static bool GetUTXOStats(CCoinsView* view, BlockManager& blockman, CCoinsStats&
{
LOCK(cs_main);
assert(std::addressof(g_chainman.m_blockman) == std::addressof(blockman));
stats.nHeight = blockman.LookupBlockIndex(stats.hashBlock)->nHeight;
const CBlockIndex* block = blockman.LookupBlockIndex(stats.hashBlock);
stats.nHeight = Assert(block)->nHeight;
}
PrepareHash(hash_obj, stats);