refactor: return reference instead of pointer

The return value of BlockManager::GetFirstBlock must always be non-null. This
can be inferred by the implementation, which has an assertion that the return
value is not null. A raw pointer should only be returned if the result may be
null. In this case a reference is more appropriate.
This commit is contained in:
Andrew Toth
2025-11-13 09:43:51 -05:00
parent f743e6c5dd
commit 99d012ec80
4 changed files with 11 additions and 11 deletions

View File

@@ -422,11 +422,11 @@ public:
* @param lower_block The earliest possible block to return. If null, the
* search can extend to the genesis block.
*
* @return A non-null pointer to the earliest block between `upper_block`
* @return A reference to the earliest block between `upper_block`
* and `lower_block`, inclusive, such that every block between the
* returned block and `upper_block` has `status_mask` flags set.
*/
const CBlockIndex* GetFirstBlock(
const CBlockIndex& GetFirstBlock(
const CBlockIndex& upper_block LIFETIMEBOUND,
uint32_t status_mask,
const CBlockIndex* lower_block LIFETIMEBOUND = nullptr