refactor: Use reference instead of pointer in IsBlockPruned

This makes it harder to pass nullptr and cause issues such as
dde7ac5c70
This commit is contained in:
MarcoFalke
2023-12-07 10:21:14 +01:00
parent dce1dfbc47
commit fa604eb6cf
5 changed files with 11 additions and 13 deletions

View File

@@ -304,10 +304,9 @@ static bool rest_block(const std::any& context,
if (!pblockindex) {
return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not found");
}
if (chainman.m_blockman.IsBlockPruned(pblockindex))
if (chainman.m_blockman.IsBlockPruned(*pblockindex)) {
return RESTERR(req, HTTP_NOT_FOUND, hashStr + " not available (pruned data)");
}
}
if (!chainman.m_blockman.ReadBlockFromDisk(block, *pblockindex)) {