OpenCBDC Transaction Processor
|
Database shard representing a fraction of the UTXO set. More...
#include <shard.hpp>
Public Member Functions | |
shard (config::shard_range_t prefix_range) | |
Constructor. | |
auto | open_db (const std::string &db_dir) -> std::optional< std::string > |
Creates or restores this shard's UTXO database. | |
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 forward to the atomizer or a transaction error to forward to the watchtower. | |
auto | digest_block (const cbdc::atomizer::block &blk) -> bool |
Updates records to reflect changes from a new, contiguous transaction block from the atomizer. | |
auto | best_block_height () const -> uint64_t |
Returns the height of the most recently digested block. | |
Database shard representing a fraction of the UTXO set.
Receives transactions from sentinels, and generates transaction input validity attestations to forward to the atomizer. Receives confirmed transaction blocks from the atomizer to update its internal state.
|
explicit |
|
nodiscard |
auto cbdc::shard::shard::digest_block | ( | const cbdc::atomizer::block & | blk | ) | -> bool |
Updates records to reflect changes from a new, contiguous transaction block from the atomizer.
Deletes spent UTXOs and adds new ones. Increments the best block height. Accepts only blocks whose block height is one greater than the previous best block height; rejects non-contiguous blocks.
blk | the block to digest. |
auto cbdc::shard::shard::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 forward to the atomizer or a transaction error to forward to the watchtower.
tx | the transaction to digest. |
Definition at line 105 of file shard.cpp.
References cbdc::atomizer::tx_notify_request::m_attestations, cbdc::atomizer::tx_notify_request::m_block_height, and cbdc::atomizer::tx_notify_request::m_tx.
auto cbdc::shard::shard::open_db | ( | const std::string & | db_dir | ) | -> std::optional<std::string> |