aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-04-04 07:47:14 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-04-04 07:37:43 +0200
commitfa8fffebe8ac126f31143619843dd6578a2f4e3c (patch)
treeb205e55ba5c41d391567305d6a61cd6e94db060a /src
parentad4bf8a94594e7fe424e409ba9474d91584bb78c (diff)
refactor: Prefer clean assert over UB in coinstats
Diffstat (limited to 'src')
-rw-r--r--src/node/coinstats.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/node/coinstats.cpp b/src/node/coinstats.cpp
index 268580c6e6..f8f0fff43f 100644
--- a/src/node/coinstats.cpp
+++ b/src/node/coinstats.cpp
@@ -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);