Database key types and constants for the transaction index.
Database layout:
['x', hash prefix, block seq, tx offset]-> (empty) ['s', block seq]-> block hash ['h', block hash]-> block seq ["next_block_seq"]-> next block seq to assign ["txid_hash_salt"]-> txid hasher salt ["best_block_v2"]-> current sync locator ['t', txid]-> legacy CDiskTxPos ['B']-> legacy sync locator
| Name | Description |
|---|---|
BlockHashKey | Key for looking up the sequence number assigned to the block with the given hash. |
BlockSeqKey | Key for looking up the hash of the block with the given sequence number. |
BlockTxPosition | The location of a transaction: the sequence number of the block that contains it and the transaction's serialized byte offset from the start of that block (including the header), so the on-disk position is simply block_data_pos + tx_offset_in_block. |
DBKey | Hashed txindex key: a truncated txid hash prefix plus the block position. |
| Name | Description |
|---|---|
TxHashKeyPrefix | Integer type holding the truncated txid hash prefix of a key. |
| Name | Description |
|---|---|
CreateKeyPrefix | Compute the txid-hash key prefix for a transaction. |
LegacyTxKey | Key of a legacy (pre-hashing) txindex row: the full txid under the 't' prefix. |
operator== | Compare two positions for equality by block sequence and offset. |
| Name | Description |
|---|---|
BLOCK_HEADER_SIZE | Serialized size of a block header, the offset of the first byte after it. |
DB_BEST_BLOCK_V2 | Key holding the sync locator for the current (v2) index format. |
DB_BLOCK_HASH | Key prefix mapping a block hash to its sequence number. |
DB_BLOCK_SEQ | Key prefix mapping a block sequence number to its block hash. |
DB_NEXT_BLOCK_SEQ | Key holding the next block sequence number to assign. |
DB_TXID_HASH_SALT | Key holding the salt used to hash txids. |
DB_TXINDEX | Prefix of a legacy (pre-hashing) txindex row. |
DB_TXINDEX_HASHED | Key prefix for a hashed txindex row keyed by txid hash prefix and position. |
EMPTY_VALUE | Empty value of a hashed txindex row, whose position is encoded in its key. |
HASH_PREFIX_SIZE | Number of leading txid-hash bytes kept in a hashed txindex key. |