[#node-BlockManager-GetFirstBlock] = xref:node.adoc[node]::xref:node/BlockManager.adoc[BlockManager]::GetFirstBlock :relfileprefix: ../../ :mrdocs: Returns the earliest block with specified `status_mask` flags set after the latest block _not_ having those flags. == Synopsis Declared in `<node/blockstorage.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[requires_capability(0x7f2e1b0997e8), requires_capability(0x7f2e26d1af48), requires_capability(0x7f2e375e1028), requires_capability(0x7f2e333683e8), requires_capability(0x7f2e3542f3d8), requires_capability(0x7f2e28a73f38)]] xref:CBlockIndex.adoc[CBlockIndex] const& GetFirstBlock( xref:CBlockIndex.adoc[CBlockIndex] const& upper_block, uint32_t status_mask, xref:CBlockIndex.adoc[CBlockIndex] const* lower_block = nullptr) const; ---- == Description This function starts from `upper_block`, which must have all `status_mask` flags set, and iterates backwards through its ancestors. It continues as long as each block has all `status_mask` flags set, until reaching the oldest ancestor or `lower_block`. == Return Value 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. == Parameters [cols="1,4"] |=== | Name| Description | *upper_block* | The starting block for the search, which must have all `status_mask` flags set. | *status_mask* | Bitmask specifying required status flags. | *lower_block* | The earliest possible block to return. If null, the search can extend to the genesis block. |=== == Preconditions * `upper_block` must have all `status_mask` flags set. * `lower_block` must be null or an ancestor of `upper_block` [.small]#Created with https://www.mrdocs.com[MrDocs]#