OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
cbdc::watchtower::watchtower Class Reference

Service to answer client requests for processing status updates on submitted transactions. More...

#include <watchtower.hpp>

Public Member Functions

 watchtower ()=delete
 
 watchtower (size_t block_cache_size, size_t error_cache_size)
 Constructor.
 
void add_block (cbdc::atomizer::block &&blk)
 Adds a new block from the Atomizer to the Watchtower.
 
void add_errors (std::vector< tx_error > &&errs)
 Adds an error from an internal component to the Watchtower's error cache.
 
auto handle_status_update_request (const status_update_request &req) -> std::unique_ptr< response >
 Composes a response to a status update request based on the data available.
 
auto handle_best_block_height_request (const best_block_height_request &req) -> std::unique_ptr< response >
 Composes a response to a status update best block height request.
 

Detailed Description

Service to answer client requests for processing status updates on submitted transactions.

Definition at line 127 of file watchtower.hpp.

Constructor & Destructor Documentation

◆ watchtower() [1/2]

cbdc::watchtower::watchtower::watchtower ( )
delete

◆ watchtower() [2/2]

cbdc::watchtower::watchtower::watchtower ( size_t block_cache_size,
size_t error_cache_size )

Constructor.

Parameters
block_cache_sizethe number of blocks to store in this Watchtower's block cache.
error_cache_sizethe number of errors to store in this Watchtower's error cache.
See also
cbdc::watchtower::BlockCache

Definition at line 161 of file watchtower.cpp.

Member Function Documentation

◆ add_block()

void cbdc::watchtower::watchtower::add_block ( cbdc::atomizer::block && blk)

Adds a new block from the Atomizer to the Watchtower.

Currently just forwards the block to the in-memory cache to await requests from clients.

Parameters
blkblock to add.

Definition at line 15 of file watchtower.cpp.

References cbdc::watchtower::block_cache::push_block().

Here is the call graph for this function:

◆ add_errors()

void cbdc::watchtower::watchtower::add_errors ( std::vector< tx_error > && errs)

Adds an error from an internal component to the Watchtower's error cache.

Parameters
errserror to add.

Definition at line 20 of file watchtower.cpp.

References cbdc::watchtower::block_cache::check_spent(), cbdc::watchtower::block_cache::check_unspent(), cbdc::watchtower::error_cache::push_errors(), cbdc::watchtower::spent, and cbdc::watchtower::unspent.

Here is the call graph for this function:

◆ handle_best_block_height_request()

auto cbdc::watchtower::watchtower::handle_best_block_height_request ( const best_block_height_request & req) -> std::unique_ptr<response>

Composes a response to a status update best block height request.

Parameters
reqa best block height request from a client.
Returns
the response to send to the client or nullopt if request is invalid.

Definition at line 153 of file watchtower.cpp.

◆ handle_status_update_request()

auto cbdc::watchtower::watchtower::handle_status_update_request ( const status_update_request & req) -> std::unique_ptr<response>

Composes a response to a status update request based on the data available.

Currently only supports check requests against blocks cached in-memory.

Error responses:

  • If the system raised an internal error while handling the transaction, every UHS ID state is marked with the InternalError status.
  • If the transaction was rejected because one of the UHS ID inputs had already been spent, or because it could not be found in any shards, the UHS ID states corresponding to problematic inputs are marked with the InvalidInput status. All other requested inputs are marked with the TxRejected status.
    Parameters
    reqa status update request from a client.
    Returns
    the response to send to the client or nullopt if request is invalid.

Definition at line 120 of file watchtower.cpp.


The documentation for this class was generated from the following files: