10#ifndef OPENCBDC_TX_SRC_SHARD_SHARD_H_
11#define OPENCBDC_TX_SRC_SHARD_SHARD_H_
24#include <leveldb/db.h>
25#include <leveldb/write_batch.h>
29#include <unordered_set>
45 auto open_db(
const std::string& db_dir) -> std::optional<std::string>;
53 -> std::variant<atomizer::tx_notify_request, watchtower::tx_error>;
69 [[nodiscard]]
auto is_output_on_shard(
const hash_t& uhs_hash)
const
72 void update_snapshot();
74 std::unique_ptr<leveldb::DB> m_db;
75 leveldb::ReadOptions m_read_options;
76 leveldb::WriteOptions m_write_options;
78 uint64_t m_best_block_height{};
80 std::shared_ptr<const leveldb::Snapshot> m_snp;
81 uint64_t m_snp_height{};
82 std::shared_mutex m_snp_mut;
84 const std::string m_best_block_height_key =
"bestBlockHeight";
86 std::pair<uint8_t, uint8_t> m_prefix_range;
Database shard representing a fraction of the UTXO set.
auto open_db(const std::string &db_dir) -> std::optional< std::string >
Creates or restores this shard's UTXO database.
auto best_block_height() const -> uint64_t
Returns the height of the most recently digested block.
auto digest_block(const cbdc::atomizer::block &blk) -> bool
Updates records to reflect changes from a new, contiguous transaction block from the atomizer.
auto digest_transaction(transaction::compact_tx tx) -> std::variant< atomizer::tx_notify_request, watchtower::tx_error >
Checks the validity of a provided transaction's inputs, and returns a transaction notification to for...
Tools for reading options from a configuration file and building application-specific parameter sets ...
std::pair< uint8_t, uint8_t > shard_range_t
[start, end] inclusive.
std::array< unsigned char, cbdc::hash_size > hash_t
SHA256 hash container.
Batch of compact transactions settled by the atomizer.
A condensed, hash-only transaction representation.
Messages atomizers and shards can use to transmit errors to the watchtower, and which the watchtower ...