[#index_util] = index_util :mrdocs: Shared database key types for blockfilterindex and coinstatsindex. == Description Index data is usually indexed by height, but in case of a reorg, entries of blocks no longer in the main chain will be copied to a hash index by which they can still be queried. Keys for the height index have the type [DB_BLOCK_HEIGHT, uint32 (BE)]. The height is represented as big‐endian so that sequential reads of filters by height are fast. Keys for the hash index have the type [DB_BLOCK_HASH, uint256]. == Types [cols="1,4"] |=== | Name| Description | xref:index_util/DBHashKey.adoc[`DBHashKey`] | Database key for an index entry looked up by block hash. | xref:index_util/DBHeightKey.adoc[`DBHeightKey`] | Database key for an index entry looked up by block height. |=== == Functions [cols="1,4"] |=== | Name| Description | xref:index_util/CopyHeightIndexToHashIndex.adoc[`CopyHeightIndexToHashIndex`] | Copy an index entry from the height index to the hash index. | xref:index_util/LookUpOne.adoc[`LookUpOne`] | Look up a single index entry for a block, trying the height index then the hash index. |=== == Variables [cols="1,4"] |=== | Name| Description | xref:index_util/DB_BLOCK_HASH.adoc[`DB_BLOCK_HASH`] | Key prefix byte identifying an entry in the hash index. | xref:index_util/DB_BLOCK_HEIGHT.adoc[`DB_BLOCK_HEIGHT`] | Key prefix byte identifying an entry in the height index. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#