5#ifndef BITCOIN_INDEX_TXINDEX_KEY_H
6#define BITCOIN_INDEX_TXINDEX_KEY_H
64 static_assert(MAX_BLOCK_SERIALIZED_SIZE <= BigEndianFormatter<TX_OFFSET_SIZE>::MAX);
81 if (ser_action.ForRead() &&
prefix !=
DB_BLOCK_SEQ)
throw std::ios_base::failure(
"Invalid format for txindex block seq key");
94 if (ser_action.ForRead() &&
prefix !=
DB_BLOCK_HASH)
throw std::ios_base::failure(
"Invalid format for txindex block hash key");
115 if (ser_action.ForRead() &&
prefix !=
DB_TXINDEX_HASHED)
throw std::ios_base::failure(
"Invalid format for txindex DB key");
A custom weaker variant of SipHash-1-3 without padding, and supporting "jumbo" inputs.
ALWAYS_INLINE uint64_t Hash(const uint256 &hash) const noexcept
Hash a jumbo block after the data written so far and finalize without modifying the object.
const uint256 & ToUint256() const LIFETIMEBOUND
const std::string DB_TXID_HASH_SALT
constexpr std::array< std::byte, 0 > EMPTY_VALUE
Empty value of a hashed txindex row, whose position is encoded in its key.
constexpr uint8_t DB_TXINDEX
Prefix of a legacy (pre-hashing) txindex row.
constexpr int HASH_PREFIX_SIZE
constexpr uint8_t DB_BLOCK_HASH
TxHashKeyPrefix CreateKeyPrefix(const SipHasher13UJ &hasher, const Txid &txid)
constexpr uint32_t BLOCK_HEADER_SIZE
Serialized size of a block header, the offset of the first byte after it.
const std::string DB_NEXT_BLOCK_SEQ
std::pair< uint8_t, uint256 > LegacyTxKey(const Txid &txid)
Key of a legacy (pre-hashing) txindex row: the full txid under the 't' prefix.
const std::string DB_BEST_BLOCK_V2
constexpr uint8_t DB_BLOCK_SEQ
constexpr uint8_t DB_TXINDEX_HASHED
static Wrapper< Formatter, T & > Using(T &&t)
Cause serialization/deserialization of an object to be done using a specified formatter class.
Key for looking up the sequence number assigned to the block with the given hash.
SERIALIZE_METHODS(BlockHashKey, obj)
Key for looking up the hash of the block with the given sequence number.
SERIALIZE_METHODS(BlockSeqKey, obj)
The location of a transaction: the sequence number of the block that contains it and the transaction'...
uint32_t tx_offset_in_block
SERIALIZE_METHODS(BlockTxPosition, obj)
friend bool operator==(const BlockTxPosition &, const BlockTxPosition &)=default
static constexpr uint32_t TX_OFFSET_SIZE
SERIALIZE_METHODS(DBKey, obj)
TxHashKeyPrefix hash_prefix