diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-04-04 07:47:14 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-04-04 07:37:43 +0200 |
commit | fa8fffebe8ac126f31143619843dd6578a2f4e3c (patch) | |
tree | b205e55ba5c41d391567305d6a61cd6e94db060a | |
parent | ad4bf8a94594e7fe424e409ba9474d91584bb78c (diff) | |
download | bitcoin-fa8fffebe8ac126f31143619843dd6578a2f4e3c.tar.xz |
refactor: Prefer clean assert over UB in coinstats
-rw-r--r-- | src/node/coinstats.cpp | 3 |
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); |