Copy an index entry from the height index to the hash index.
Declared in <index/db_key.h>
template<typename DBVal>
[[nodiscard]]
static
bool
CopyHeightIndexToHashIndex(
CDBIterator& db_it,
CDBBatch& batch,
std::string const& index_name,
int height);
Used during a reorg so entries for blocks no longer on the main chain remain queryable by hash.
True on success, false if the expected entry could not be read.
The return value should not be discarded.
| Name | Description |
|---|---|
| DBVal | Type of the value stored for the entry. |
| Name | Description |
|---|---|
| db_it | Iterator positioned to read the height-indexed entry. |
| batch | Write batch that the hash-indexed copy is added to. |
| index_name | Name of the index, used for error logging. |
| height | Block height of the entry to copy. |