5#ifndef BITCOIN_INDEX_DB_KEY_H
6#define BITCOIN_INDEX_DB_KEY_H
37 template<
typename Stream>
44 template<
typename Stream>
49 throw std::ios_base::failure(
"Invalid format for index DB height key");
64 throw std::ios_base::failure(
"Invalid format for index DB hash key");
71template <
typename DBVal>
79 LogError(
"unexpected key in %s: expected (%c, %d)",
84 std::pair<uint256, DBVal> value;
85 if (!
db_it.GetValue(value)) {
86 LogError(
"unable to read value in %s at key (%c, %d)",
95template <
typename DBVal>
106 result = std::move(
read_out.second);
Batch of changes queued to be written to a CDBWrapper.
void Write(const K &key, const V &value)
static bool LookUpOne(const CDBWrapper &db, const interfaces::BlockRef &block, DBVal &result)
static constexpr uint8_t DB_BLOCK_HASH
static constexpr uint8_t DB_BLOCK_HEIGHT
static bool CopyHeightIndexToHashIndex(CDBIterator &db_it, CDBBatch &batch, const std::string &index_name, int height)
uint8_t ser_readdata8(Stream &s)
void ser_writedata32be(Stream &s, uint32_t obj)
void ser_writedata8(Stream &s, uint8_t obj)
uint32_t ser_readdata32be(Stream &s)
DBHashKey(const uint256 &hash_in)
SERIALIZE_METHODS(DBHashKey, obj)
DBHeightKey(int height_in)
void Unserialize(Stream &s)
void Serialize(Stream &s) const
Hash/height pair to help track and identify blocks.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.