Copy an index entry from the height index to the hash index.

Synopsis

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);

Description

Used during a reorg so entries for blocks no longer on the main chain remain queryable by hash.

Return Value

True on success, false if the expected entry could not be read.

Note

The return value should not be discarded.

Template Parameters

Name

Description

DBVal

Type of the value stored for the entry.

Parameters

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.

Created with MrDocs