15        : m_ep(std::move(ep)) {}
 
 
   19        m_client_thread.join();
 
 
   24        auto ct = m_network.start_cluster_handler(
 
   27                -> std::optional<cbdc::buffer> {
 
   31                    std::make_shared<cbdc::watchtower::response>(res));
 
   39        m_client_thread = std::move(ct.value());
 
 
   45        -> std::shared_ptr<best_block_height_response> {
 
   48        m_network.broadcast(pkt);
 
   50        std::shared_ptr<response> res;
 
   51        if(!m_res_q.pop(res)) {
 
   54        return std::make_shared<best_block_height_response>(
 
   55            std::get<best_block_height_response>(res->payload()));
 
 
   60        -> std::shared_ptr<status_request_check_success> {
 
   63        m_network.broadcast(pkt);
 
   65        std::shared_ptr<response> res;
 
   66        if(!m_res_q.pop(res)) {
 
   69        return std::make_shared<status_request_check_success>(
 
   70            std::get<status_request_check_success>(res->payload()));
 
 
   76        m_handler_running = 
false;
 
   79        if(m_handler_thread.joinable()) {
 
   80            m_handler_thread.join();
 
   82        m_client_thread.join();
 
 
   87        auto ct = m_network.start_cluster_handler(
 
   90                -> std::optional<cbdc::buffer> {
 
   94                    std::make_shared<cbdc::watchtower::response>(res));
 
  102        m_client_thread = std::move(ct.value());
 
  104        m_handler_running = 
true;
 
  105        m_handler_thread = std::thread{[
this]() {
 
  106            while(m_handler_running) {
 
  107                std::shared_ptr<response> res;
 
  108                if(!m_res_q.pop(res)) {
 
  116                                std::make_shared<status_request_check_success>(
 
  121                                std::make_shared<best_block_height_response>(
 
 
  145        m_su_handler = handler;
 
 
  150        m_bbh_handler = handler;
 
 
Serializer implementation for buffer.
void close()
Shuts down the network listener and all existing peer connections.
void broadcast(const std::shared_ptr< buffer > &data)
Sends the provided data to all added peers.
auto init() -> bool
Attempts to connect to the watchtower.
void set_block_height_handler(const best_block_height_handler_t &handler)
Sets or replaces the handler for asynchronously delivered StatusUpdateResponses.
void request_status_update(const status_update_request &req)
Sends a StatusUpdateRequest to the Watchtower.
void set_status_update_handler(const status_update_response_handler_t &handler)
Sets or replaces the handler for asynchronously delivered StatusUpdateResponses.
void request_best_block_height()
Sends a request_best_block_height to the Watchtower.
std::function< void( std::shared_ptr< best_block_height_response > &&)> best_block_height_handler_t
std::function< void( std::shared_ptr< status_request_check_success > &&)> status_update_response_handler_t
Contains the watchtower's known best block height.
auto init() -> bool
Attempts to connect to the watchtower.
auto request_status_update(const status_update_request &req) -> std::shared_ptr< status_request_check_success >
Sends a StatusUpdateRequest to the Watchtower.
auto request_best_block_height() -> std::shared_ptr< best_block_height_response >
Sends a request_best_block_height to the Watchtower.
RPC request message to the watchtower external endpoint.
RPC response message from the watchtower external endpoint.
Indicates a successful check request, sent with a StatusUpdateResponse.
Network request to interact with the Watchtower's status update service.
std::pair< ip_address, port_number_t > endpoint_t
[host name, port number].
auto make_shared_buffer(const T &obj) -> std::shared_ptr< cbdc::buffer >
Serialize object into std::shared_ptr<cbdc::buffer> using a cbdc::buffer_serializer.
Variant handler template.
Request the watchtower's known best block height.
Client helpers for interfacing with a watchtower server.
Watchtower core functionality.