GetFirstStoredBlock is generalized to check for any data status with a
status mask that needs to be passed as a parameter. To reflect this the
function is also renamed to GetFirstBlock.Co-authored-by: stickies-v <stickies-v@protonmail.com>
In our codebase the status mask is a private member of BlockStatus, but we can achieve the same thing by passing a test function that takes a BlockStatus and returns a bool.
Core -> Bitcoin ABC GetFirstBlock(upper_block, BLOCK_HAVE_DATA, &lower_block) -> GetFirstBlock(upper_block, [](BlockStatus status) {return status.hasData();}, &lower_block) GetFirstBlock(upper_block, BLOCK_HAVE_MASK, &lower_block) -> GetFirstBlock(upper_block, [](BlockStatus status) {return status.hasData() && status.hasUndo();}, &lower_block)
This is a partial backport of core#29668
https://github.com/bitcoin/bitcoin/pull/29668/commits/96b4facc912927305b06a233cb8b36e7e5964c08