nor does BlockManager instance retain references to the parameters
First I though we might as well make it const to add more weight to the claim that LIFETIMEBOUND isn’t needed here:
0 bool CheckBlockDataAvailability(const CBlockIndex& upper_block, const CBlockIndex& lower_block) const EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
But it turns out the internally called GetFirstBlock can actually be static (which would document LIFETIMEBOUND a lot better, since we know the bound is in the return value, not the instance):
0static const CBlockIndex& GetFirstBlock(
1 const CBlockIndex& upper_block LIFETIMEBOUND,
2 uint32_t status_mask,
3 const CBlockIndex* lower_block LIFETIMEBOUND = nullptr
4) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
which would allow making this static, too:
0 static bool CheckBlockDataAvailability(const CBlockIndex& upper_block, const CBlockIndex& lower_block) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
Changing it to static reveals that the call stack seems to pass blockman needlessly, e.g. https://github.com/bitcoin/bitcoin/blob/141117f5e8b41eb27539d217aa4e6c407c067d90/src/rpc/blockchain.cpp#L858 so changing the references shouldn’t be done in this PR - but we might as well mark them as static here for consistency.