OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
status_update.cpp
Go to the documentation of this file.
1// Copyright (c) 2021 MIT Digital Currency Initiative,
2// Federal Reserve Bank of Boston
3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#include "status_update.hpp"
7
8namespace cbdc::watchtower {
12
14 return m_uhs_ids;
15 }
16
17 auto
19 -> bool {
20 return rhs.m_uhs_ids == m_uhs_ids;
21 }
22
26
31
33 return m_status;
34 }
35
36 auto status_update_state::block_height() const -> uint64_t {
37 return m_block_height;
38 }
39
41 return m_uhs_id;
42 }
43
45 -> bool {
46 return (rhs.m_status == m_status)
47 && (rhs.m_block_height == m_block_height)
48 && (rhs.m_uhs_id == m_uhs_id);
49 }
50
51 status_update_state::status_update_state(search_status status,
52 uint64_t block_height,
53 hash_t uhs_id)
54 : m_status(status),
55 m_block_height(block_height),
56 m_uhs_id(uhs_id) {}
57
62
64 return m_states;
65 }
66
68 const status_request_check_success& rhs) const -> bool {
69 return (rhs.m_states == m_states);
70 }
71
73 tx_id_states states)
74 : m_states(std::move(states)) {}
75}
Interface for serializing objects into and out of raw bytes representations.
Indicates a successful check request, sent with a StatusUpdateResponse.
auto states() const -> const tx_id_states &
Returns the states of a set of UHS IDs, following the order of the UHS IDs in the containing StatusUp...
auto operator==(const status_request_check_success &rhs) const -> bool
Network request to interact with the Watchtower's status update service.
auto uhs_ids() const -> const tx_id_uhs_ids &
UHS IDs for which the client would like to search.
auto operator==(const status_update_request &rhs) const -> bool
Represents the internal state of an ongoing status update request.
auto operator==(const status_update_state &rhs) const -> bool
status_update_state(search_status status, uint64_t block_height, hash_t uhs_id)
Constructor.
auto block_height() const -> uint64_t
Return the block height of the block containing the transaction in which the UHS ID was found.
auto status() const -> search_status
Returns the current SearchStatus of the StatusUpdate.
auto uhs_id() const -> hash_t
Returns the UHS ID for which the status is valid.
search_status
The current status of the Watchtower's progress in searching for a particular UHS ID.
std::unordered_map< hash_t, std::vector< hash_t >, hashing::const_sip_hash< hash_t > > tx_id_uhs_ids
Set of UHS IDs to query, keyed by Tx IDs.
std::unordered_map< hash_t, std::vector< status_update_state >, hashing::const_sip_hash< hash_t > > tx_id_states
Reported UHS ID states, keyed by Tx IDs.
std::array< unsigned char, cbdc::hash_size > hash_t
SHA256 hash container.